1
0
mirror of https://github.com/webrecorder/pywb.git synced 2025-03-24 06:59:52 +01:00

Merge branch '0.5.4-work' into develop

This commit is contained in:
Ilya Kreymer 2014-08-06 13:22:08 -07:00
commit c3c7935546
2 changed files with 9 additions and 0 deletions

View File

@ -1,5 +1,6 @@
import re import re
from io import BytesIO from io import BytesIO
from urlparse import urlsplit
from pywb.utils.statusandheaders import StatusAndHeaders from pywb.utils.statusandheaders import StatusAndHeaders
from pywb.utils.wbexception import WbException, NotFoundException from pywb.utils.wbexception import WbException, NotFoundException
@ -224,6 +225,9 @@ class ReplayView(object):
return return
location_url = location_url.lower() location_url = location_url.lower()
if location_url.startswith('/'):
host = urlsplit(cdx['original']).netloc
location_url = host + location_url
if (ReplayView.strip_scheme(request_url) == if (ReplayView.strip_scheme(request_url) ==
ReplayView.strip_scheme(location_url)): ReplayView.strip_scheme(location_url)):

View File

@ -241,6 +241,11 @@ class TestWb:
assert resp.status_int == 200 assert resp.status_int == 200
assert resp.content_type == 'text/css' assert resp.content_type == 'text/css'
def test_rel_self_redirect(self):
uri = '/pywb/20140126200927mp_/http://www.iana.org/domains/root/db'
resp = self.testapp.get(uri, status=302)
assert resp.status_int == 302
assert resp.headers['Location'].endswith('/pywb/20140126200928mp_/http://www.iana.org/domains/root/db')
def test_referrer_self_redirect(self): def test_referrer_self_redirect(self):
uri = '/pywb/20140127171239mp_/http://www.iana.org/_css/2013.1/screen.css' uri = '/pywb/20140127171239mp_/http://www.iana.org/_css/2013.1/screen.css'