When the response is a 304 turn off chunked responses as there is a guarantee there is no response body (hence no Content-Length defined)

This can cause odd behavior with browsers not being able to parse the response
correctly (not sure if this is just a property of empty chunked responses or
something else)
This commit is contained in:
Brian Rosner 2011-04-07 23:40:19 -06:00 committed by benoitc
parent 5aabdc0ae2
commit 6dc33b1ca4

View File

@ -208,6 +208,10 @@ class Response(object):
return False
elif self.req.version <= (1,0):
return False
elif self.status.startswith("304"):
# Do not use chunked responses when the response is guaranteed to
# not have a response body.
return False
return True
def default_headers(self):