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

Use actual page scheme instead of defaulting to http when extracting original url (#404)

* client-side rewrite: fix extract_orig() to unrewrite relative urls using current page scheme, don't default to http

* wombat tests: fix karma tests by adding 'wombat_scheme' to test setup
This commit is contained in:
Ilya Kreymer 2018-10-31 20:50:43 -07:00 committed by GitHub
parent f805f79388
commit 3e0bb49ae1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 2 deletions

View File

@ -142,6 +142,7 @@ describe('WombatJS', function () {
initScript: function () { initScript: function () {
wbinfo = { wbinfo = {
wombat_opts: {}, wombat_opts: {},
wombat_scheme: 'http',
prefix: window.location.origin, prefix: window.location.origin,
wombat_ts: '', wombat_ts: '',
is_live: false, is_live: false,
@ -183,6 +184,7 @@ describe('WombatJS', function () {
wombat_opts: {}, wombat_opts: {},
prefix: window.location.origin, prefix: window.location.origin,
wombat_ts: '', wombat_ts: '',
wombat_scheme: 'http',
is_live: false, is_live: false,
top_url: '' top_url: ''
}; };
@ -205,6 +207,7 @@ describe('WombatJS', function () {
initScript: function () { initScript: function () {
wbinfo = { wbinfo = {
wombat_opts: {}, wombat_opts: {},
wombat_scheme: 'http',
is_live: false, is_live: false,
top_url: '' top_url: ''
}; };

View File

@ -505,7 +505,7 @@ var _WBWombat = function($wbwindow, wbinfo) {
} }
if (href != orig_href && !starts_with(href, VALID_PREFIXES)) { if (href != orig_href && !starts_with(href, VALID_PREFIXES)) {
href = HTTP_PREFIX + href; href = wb_orig_scheme + href;
} }
} }
@ -514,7 +514,7 @@ var _WBWombat = function($wbwindow, wbinfo) {
} }
if (starts_with(href, REL_PREFIX)) { if (starts_with(href, REL_PREFIX)) {
href = "http:" + href; href = wb_info.wombat_scheme + ":" + href;
} }
return href; return href;