mirror of
https://github.com/webrecorder/pywb.git
synced 2025-03-15 00:03:28 +01:00
proxy: fix wombat.js to work in proxy mode! rewrite only https -> http
This commit is contained in:
parent
b8a9f429fb
commit
950673908d
@ -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);
|
||||
@ -683,20 +697,22 @@ WB_wombat_init = (function() {
|
||||
//============================================
|
||||
function wombat_init(replay_prefix, capture_date, orig_scheme, orig_host, timestamp) {
|
||||
wb_replay_prefix = replay_prefix;
|
||||
|
||||
wb_replay_date_prefix = replay_prefix + capture_date + "em_/";
|
||||
|
||||
if (capture_date.length > 0) {
|
||||
wb_capture_date_part = "/" + capture_date + "/";
|
||||
} else {
|
||||
wb_capture_date_part = "";
|
||||
if (wb_replay_prefix) {
|
||||
wb_replay_date_prefix = replay_prefix + capture_date + "em_/";
|
||||
|
||||
if (capture_date.length > 0) {
|
||||
wb_capture_date_part = "/" + capture_date + "/";
|
||||
} else {
|
||||
wb_capture_date_part = "";
|
||||
}
|
||||
|
||||
wb_orig_scheme = orig_scheme + '://';
|
||||
|
||||
wb_orig_host = wb_orig_scheme + orig_host;
|
||||
|
||||
init_bad_prefixes(replay_prefix);
|
||||
}
|
||||
|
||||
wb_orig_scheme = orig_scheme + '://';
|
||||
|
||||
wb_orig_host = wb_orig_scheme + orig_host;
|
||||
|
||||
init_bad_prefixes(replay_prefix);
|
||||
|
||||
// Location
|
||||
var wombat_location = new WombatLocation(window.self.location);
|
||||
|
Loading…
x
Reference in New Issue
Block a user