mirror of
https://github.com/webrecorder/pywb.git
synced 2025-03-24 06:59:52 +01:00
warcserver: self-redirect improvement: include trailing slash in self-redirect check, urls differing only by trailing slash should be considered self-redirect, update tests
This commit is contained in:
parent
da2ae0f373
commit
0c74616070
@ -139,8 +139,8 @@ class BaseLoader(object):
|
|||||||
host = urlsplit(cdx['url']).netloc
|
host = urlsplit(cdx['url']).netloc
|
||||||
location_url = host + location_url
|
location_url = host + location_url
|
||||||
|
|
||||||
location_url = location_url.split('://', 1)[-1]
|
location_url = location_url.split('://', 1)[-1].rstrip('/')
|
||||||
request_url = request_url.split('://', 1)[-1]
|
request_url = request_url.split('://', 1)[-1].rstrip('/')
|
||||||
|
|
||||||
if request_url == location_url:
|
if request_url == location_url:
|
||||||
msg = 'Self Redirect {0} -> {1}'
|
msg = 'Self Redirect {0} -> {1}'
|
||||||
|
@ -350,6 +350,12 @@ class TestWbIntegration(BaseConfigTest):
|
|||||||
assert resp.status_int == 200
|
assert resp.status_int == 200
|
||||||
assert resp.headers['Content-Location'].endswith('/pywb/20140126200928{0}/http://www.iana.org/domains/root/db'.format(fmod))
|
assert resp.headers['Content-Location'].endswith('/pywb/20140126200928{0}/http://www.iana.org/domains/root/db'.format(fmod))
|
||||||
|
|
||||||
|
def test_non_exact_replay_skip_self_redir_slash(self, fmod):
|
||||||
|
uri = '/pywb/20140126200927{0}/http://www.iana.org/domains/root/db/'
|
||||||
|
resp = self.get(uri, fmod)
|
||||||
|
assert resp.status_int == 200
|
||||||
|
assert resp.headers['Content-Location'].endswith('/pywb/20140126200928{0}/http://www.iana.org/domains/root/db'.format(fmod))
|
||||||
|
|
||||||
def test_not_existant_warc_other_capture(self, fmod):
|
def test_not_existant_warc_other_capture(self, fmod):
|
||||||
resp = self.get('/pywb/20140703030321{0}/http://example.com/?example=2', fmod)
|
resp = self.get('/pywb/20140703030321{0}/http://example.com/?example=2', fmod)
|
||||||
assert resp.status_int == 200
|
assert resp.status_int == 200
|
||||||
|
Loading…
x
Reference in New Issue
Block a user