Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
bdraco committed Oct 27, 2023
1 parent 3407a5d commit e4c3291
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions aiohttp/http_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -343,13 +343,12 @@ def get_content_length() -> Optional[int]:
# calculate payload
# 204, 304, 1xx should not have a body per
# https://datatracker.ietf.org/doc/html/rfc9112#section-6.3
code_indicates_empty_body = self.code in (204, 304) or (
self.code and 100 <= self.code < 200
)
if (
(length is not None and length > 0)
or (
msg.chunked
and self.code not in (204, 304)
and not (self.code and 100 <= self.code < 200)
)
or (msg.chunked and not code_indicates_empty_body)
and not msg.upgrade
):
payload = StreamReader(
Expand Down Expand Up @@ -391,7 +390,7 @@ def get_content_length() -> Optional[int]:
)
else:
if (
getattr(msg, "code", 100) >= 199
not code_indicates_empty_body
and length is None
and self.read_until_eof
):
Expand Down

0 comments on commit e4c3291

Please sign in to comment.