Remove dead code in swob.Response.__init__.
self.status would have been "200 OK", not 200, so the branch was never taken. self.status_int would have been 200. This looked like part of an attempt to honor the Range header in GET requests. However, when I changed the code to check if self.status_int == 200, the behavior gets weird. In the case of a GET request w/Range header, the status gets changed from a 200 (from the underlying app/middleware stack) into a 206. However, the response body isn't actually changed to be of the right length. The net result is a response w/status "206 Partial Content" that actually contains the full content. RFC 2616 section 14.35.2 says "A server MAY ignore the Range header." The right thing to do is either (a) return a 206 with actual partial content, or (b) ignore the Range header. For object GETs, there's already code to do (a) [see commit ce274b3]. For other GETs, we should ignore the Range header instead of returning a Frankenresponse. This code is dead, and rightly so; let's bury it six feet deep in the bit bucket. Fixes bug 1068279. Change-Id: Id648dfda9cba45012b5da097a235598fbd97c8b0
This commit is contained in:
parent
94d295e409
commit
cda914d740
@ -856,8 +856,6 @@ class Response(object):
|
||||
self.boundary = "%.32x" % random.randint(0, 256 ** 16)
|
||||
if request:
|
||||
self.environ = request.environ
|
||||
if request.range and self.status == 200:
|
||||
self.status = 206
|
||||
else:
|
||||
self.environ = {}
|
||||
self.headers.update(headers)
|
||||
|
Loading…
x
Reference in New Issue
Block a user