Skip to content
This repository has been archived by the owner on Aug 2, 2024. It is now read-only.

Commit

Permalink
self-redirect check: run redirect check if status code is blank or do…
Browse files Browse the repository at this point in the history
…es not start with 2, 4, 5,

to more aggressively check invalid status codes, should fix ukwa/ukwa-pywb#21
  • Loading branch information
ikreymer committed Mar 2, 2018
1 parent 86810c7 commit 16f6b23
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions pywb/warcserver/resource/responseloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,10 @@ def local_index_query(local_params):
http_headers_buff = None
if payload.rec_type in ('response', 'revisit'):
status = cdx.get('status')
# status may not be set for 'revisit'
if not status or status.startswith('3'):

# if status is not set and not, 2xx, 4xx, 5xx
# go through self-redirect check just in case
if not status or not status.startswith(('2', '4', '5')):
http_headers = self.headers_parser.parse(payload.raw_stream)
self.raise_on_self_redirect(params, cdx,
http_headers.get_statuscode(),
Expand Down

0 comments on commit 16f6b23

Please sign in to comment.