Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

transport/http: Fix handling of nil and http.NoBody in Request.Build #356

Merged
merged 1 commit into from
Mar 7, 2022

Conversation

jasdel
Copy link
Contributor

@jasdel jasdel commented Feb 25, 2022

Updates the smithy-go HTTP Request to correctly handle building the request to an http.Request. HTTP Client Request must not have a non-nil Body if the ContentLength is 0. The client will treat this case as unknown length and use "transfer-encoding": chunked. This breaks Amazon S3 operations like PutObject which require content-length and do not
support "transfer-encoding: chunked"

Related to aws/aws-sdk-go-v2#1583

Updates the smithy-go HTTP Request to correctly handle building the
request to an http.Request. HTTP Client Request must not have a non-nil
Body if the ContentLength is 0. The client will treat this case as
unknown length and use "transfer-encoding": chunked. This breaks Amazon
S3 operations like PutObject which require content-length and do not
support "transfer-encoding: chunked"

Related to aws/aws-sdk-go-v2#1583
@jasdel jasdel merged commit 90a0225 into main Mar 7, 2022
@jasdel jasdel deleted the fixup/RequestBody branch March 7, 2022 17:53
jasdel added a commit that referenced this pull request Mar 8, 2022
Adds a fix for the HTTP Request setStream to correctly handle empty
and empty unseekable teams. This fixes a bug where the HTTP request
would attempt to rewind an empty unseekable stream due to assumptions
that the stream would be nil if content length is 0.

Related to #356
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants