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

fix self-redirect check with relative urls in Location

This commit is contained in:
Ilya Kreymer 2014-08-06 12:39:48 -07:00
parent b68ef06067
commit 75cda15ea4

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)):