Skip to content

Commit

Permalink
When the response is a 304 turn off chunked responses as there is a g…
Browse files Browse the repository at this point in the history
…uarantee 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)
  • Loading branch information
brosner authored and benoitc committed Aug 21, 2011
1 parent 5aabdc0 commit 6dc33b1
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions gunicorn/http/wsgi.py
Expand Up @@ -208,6 +208,10 @@ def is_chunked(self):
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):
Expand Down

0 comments on commit 6dc33b1

Please sign in to comment.