1
0
mirror of https://github.com/webrecorder/pywb.git synced 2025-03-24 15:09:54 +01:00

proxy: fix wombat.js to work in proxy mode! rewrite only https -> http

This commit is contained in:
Ilya Kreymer 2014-07-21 14:41:49 -07:00
parent b8a9f429fb
commit 950673908d

View File

@ -121,6 +121,15 @@ WB_wombat_init = (function() {
return url;
}
// proxy mode: If no wb_replay_prefix, only rewrite https:// -> http://
if (!wb_replay_prefix) {
if (starts_with(url, HTTPS_PREFIX)) {
return HTTP_PREFIX + url.substr(HTTPS_PREFIX.length);
} else {
return url;
}
}
// just in case wombat reference made it into url!
url = url.replace("WB_wombat_", "");
@ -181,6 +190,11 @@ WB_wombat_init = (function() {
return "";
}
// proxy mode: no extraction needed
if (!wb_replay_prefix) {
return href;
}
href = href.toString();
var index = href.indexOf("/http", 1);
@ -684,6 +698,7 @@ WB_wombat_init = (function() {
function wombat_init(replay_prefix, capture_date, orig_scheme, orig_host, timestamp) {
wb_replay_prefix = replay_prefix;
if (wb_replay_prefix) {
wb_replay_date_prefix = replay_prefix + capture_date + "em_/";
if (capture_date.length > 0) {
@ -697,6 +712,7 @@ WB_wombat_init = (function() {
wb_orig_host = wb_orig_scheme + orig_host;
init_bad_prefixes(replay_prefix);
}
// Location
var wombat_location = new WombatLocation(window.self.location);