mirror of
https://github.com/webrecorder/pywb.git
synced 2025-03-28 00:25:21 +01:00
replay: ignore 304 captures
This commit is contained in:
parent
584d826f05
commit
4fdcdc98ae
@ -178,9 +178,17 @@ 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'):
|
||||||
|
return
|
||||||
|
|
||||||
request_url = wbrequest.wb_url.url.lower()
|
request_url = wbrequest.wb_url.url.lower()
|
||||||
location_url = status_headers.get_header('Location').lower()
|
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)):
|
if (UrlRewriter.strip_protocol(request_url) == UrlRewriter.strip_protocol(location_url)):
|
||||||
raise CaptureException('Self Redirect: ' + str(cdx))
|
raise CaptureException('Self Redirect: ' + str(cdx))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user