mirror of
https://github.com/webrecorder/pywb.git
synced 2025-03-24 06:59:52 +01:00
replay: ignore 304 captures
This commit is contained in:
parent
584d826f05
commit
4fdcdc98ae
@ -178,12 +178,20 @@ class ReplayView:
|
|||||||
Check if response is a 3xx redirect to the same url
|
Check if response is a 3xx redirect to the same url
|
||||||
If so, reject this capture to avoid causing redirect loop
|
If so, reject this capture to avoid causing redirect loop
|
||||||
"""
|
"""
|
||||||
if status_headers.statusline.startswith('3'):
|
if not status_headers.statusline.startswith('3'):
|
||||||
request_url = wbrequest.wb_url.url.lower()
|
return
|
||||||
location_url = status_headers.get_header('Location').lower()
|
|
||||||
|
|
||||||
if (UrlRewriter.strip_protocol(request_url) == UrlRewriter.strip_protocol(location_url)):
|
request_url = wbrequest.wb_url.url.lower()
|
||||||
raise CaptureException('Self Redirect: ' + str(cdx))
|
location_url = status_headers.get_header('Location')
|
||||||
|
if not location_url:
|
||||||
|
if status_headers.statusline.startswith('304'):
|
||||||
|
raise CaptureException('Skipping 304 Modified: ' + str(cdx))
|
||||||
|
return
|
||||||
|
|
||||||
|
location_url = location_url.lower()
|
||||||
|
|
||||||
|
if (UrlRewriter.strip_protocol(request_url) == UrlRewriter.strip_protocol(location_url)):
|
||||||
|
raise CaptureException('Self Redirect: ' + str(cdx))
|
||||||
|
|
||||||
def _reject_referrer_self_redirect(self, wbrequest):
|
def _reject_referrer_self_redirect(self, wbrequest):
|
||||||
"""
|
"""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user