Skip to content

Commit ad5a43d

Browse files
committed
replay redirect: ensure no timestamp redirect when range request is
present, alter test to include inexact timestamp
1 parent 181c18a commit ad5a43d

File tree

3 files changed

+5
-1
lines changed

3 files changed

+5
-1
lines changed

pywb/framework/wbrequestresponse.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ def extract_range(self):
143143
return None
144144

145145
start = int(start)
146+
self.custom_params['noredir'] = True
146147

147148
if end:
148149
end = int(end)

pywb/webapp/replay_views.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,9 @@ def _redirect_if_needed(self, wbrequest, cdx):
224224
if not redir_needed:
225225
return None
226226

227+
if self.enable_range_cache and wbrequest.extract_range():
228+
return None
229+
227230
new_url = (wbrequest.urlrewriter.
228231
get_new_url(timestamp=cdx['timestamp'],
229232
url=cdx['original']))

tests/test_integration.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ def test_replay_identity_1(self):
173173

174174
def test_replay_range_cache_content(self):
175175
headers = [('Range', 'bytes=0-200')]
176-
resp = self.testapp.get('/pywb/20140127171251id_/http://example.com', headers=headers)
176+
resp = self.testapp.get('/pywb/20140127171250id_/http://example.com', headers=headers)
177177

178178
assert resp.status_int == 206
179179
assert resp.headers['Accept-Ranges'] == 'bytes'

0 commit comments

Comments
 (0)