Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(87)

Unified Diff: net/tools/testserver/testserver.py

Issue 1444253003: Use If-Range instead of If-Match/If-Unmodified-Since for partial requests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Make it obvious that the interrupt reason is obsolete. Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: net/tools/testserver/testserver.py
diff --git a/net/tools/testserver/testserver.py b/net/tools/testserver/testserver.py
index 7919f87b8f079dea4fd00546bae5a2c1c3cfbace..10ade37b9ef9395e99b9b39321015ea43677657e 100755
--- a/net/tools/testserver/testserver.py
+++ b/net/tools/testserver/testserver.py
@@ -1629,6 +1629,12 @@ class TestPageHandler(testserver_base.BasePageHandler):
# a range?
range_response = False
range_header = self.headers.getheader('range')
+
+ if fail_precondition and self.headers.getheader('If-Range'):
+ # Failing a precondition for an If-Range just means that we are going to
+ # return the entire entity ignoring the Range header.
+ respond_to_range = False
+
if range_header and respond_to_range:
mo = re.match("bytes=(\d*)-(\d*)", range_header)
if mo.group(1):
@@ -1641,13 +1647,6 @@ class TestPageHandler(testserver_base.BasePageHandler):
if last_byte < first_byte:
return False
- if (fail_precondition and
- (self.headers.getheader('If-Modified-Since') or
- self.headers.getheader('If-Match'))):
- self.send_response(412)
- self.end_headers()
- return True
-
if range_response:
self.send_response(206)
self.send_header('Content-Range',

Powered by Google App Engine
This is Rietveld 408576698