fix: avoid chunked framing for bodiless aiohttp requests - #753
Open
jonathan343 wants to merge 1 commit into
Open
fix: avoid chunked framing for bodiless aiohttp requests#753jonathan343 wants to merge 1 commit into
jonathan343 wants to merge 1 commit into
Conversation
Alan4506
approved these changes
Jul 27, 2026
Alan4506
left a comment
Contributor
There was a problem hiding this comment.
LGTM! Thanks @jonathan343!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes
AIOHTTPClientrequests that contain no payload but are transmitted as chunked streams.This was observed with Amazon Polly’s
DescribeVoicesoperation. The request reached the service, but Polly never returned response headers. The same operation completed normally when usingAWSCRTHTTPClient.Root cause
Smithy represents an omitted request payload as an empty
AsyncBytesReader. Before this change,AIOHTTPClientpassed that reader to aiohttp as request data.Because aiohttp cannot determine the length of an arbitrary async iterable, it selected chunked transfer encoding:
Although an empty chunked request is permitted by HTTP, Polly did not return response headers for the observed request shape. The client consequently continued waiting until canceled or timed out.
The CRT transport does not produce this HTTP/1.1 chunked framing. Its HTTP/1.1 path omits an empty buffered body stream, while HTTP/2 does not use chunked transfer encoding.
Changes
AIOHTTPClientnow distinguishes between an empty seekable body and a stream with data:None.Content-LengthorTransfer-Encodingheaders retain their existing framing behavior.For a bodyless operation, aiohttp now emits an ordinary request without payload framing:
Verification
Observed behavior:
Received 15 voicesBy submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.