Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
derlih committed Oct 24, 2020
1 parent 460faa9 commit 129df48
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGES/4901.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Server doesn't send Content-Length for 1xx or 204
4 changes: 4 additions & 0 deletions aiohttp/web_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,10 @@ async def _prepare_headers(self) -> None:
del headers[hdrs.CONTENT_LENGTH]
else:
keep_alive = False
# HTTP 1.1: https://tools.ietf.org/html/rfc7230#section-3.3.2
# HTTP 1.0: https://tools.ietf.org/html/rfc1945#section-10.4
elif version >= HttpVersion11 and self.status in (100, 101, 102, 103, 204):
del headers[hdrs.CONTENT_LENGTH]

headers.setdefault(hdrs.CONTENT_TYPE, "application/octet-stream")
headers.setdefault(hdrs.DATE, rfc822_formatted_time())
Expand Down

0 comments on commit 129df48

Please sign in to comment.