Skip to content

fix: lowercase all headers in request serialization #261

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

Merged
merged 1 commit into from
Jan 13, 2021

Conversation

AllanZhengYP
Copy link
Contributor

The HTTP request class doesn't have any implementations to insure
case-insensitivity of the http headers. So we need to be mindful
when populating these headers. Otherwise, the reqeust signature
will be messed up. This change will ensure the protocol-specific
default headers like content-type will be overriden by the serialized
header if exists.

For other headers added through middleware stack either by
customization or users, it wouldn't affect signing or sending as long
as the request doesn't contain same header names in different casing.
All the internal headers will be consistent. But users should be
careful when they are adding their own headers.

We don't add middleware to lowercase all headers to prevent
alternating the users' customizations.

Fixes: aws/aws-sdk-js-v3#1800
Ref: aws/aws-sdk-js-v3#1892

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@AllanZhengYP AllanZhengYP requested a review from kstich January 8, 2021 19:46
trivikr
trivikr previously approved these changes Jan 8, 2021
@trivikr trivikr self-requested a review January 8, 2021 19:55
@trivikr trivikr dismissed their stale review January 8, 2021 19:55

CI failed, protocol_tests need to be updated

The HTTP request class doesn't have any implementations to insure
case-insensitivity of the http headers. So we need to be mindful
when populating these headers. Otherwise, the reqeust signature
will be messed up. This change will ensure the protocol-specific
default headers like content-type will be overriden by the serialized
header if exists.

For other headers added through middleware stack either by
customization or users, it wouldn't affect signing or sending as long
as the request doesn't contain same header names in different casing.
All the internal headers will be consistent. But users should be
careful when they are adding their own headers.

We don't add middleware to lowercase all headers to prevent
alternating the users' customizations.

Ref: aws/aws-sdk-js-v3#1800
@AllanZhengYP
Copy link
Contributor Author

AllanZhengYP commented Jan 11, 2021

@kstich This is ready. And the v3 integ test is done.

@AllanZhengYP AllanZhengYP requested a review from trivikr January 12, 2021 00:39
@AllanZhengYP AllanZhengYP merged commit e92c8f6 into smithy-lang:main Jan 13, 2021
srchase pushed a commit to srchase/smithy-typescript that referenced this pull request Mar 17, 2023
The HTTP request class doesn't have any implementations to insure
case-insensitivity of the http headers. So we need to be mindful
when populating these headers. Otherwise, the reqeust signature
will be messed up. This change will ensure the protocol-specific
default headers like content-type will be overriden by the serialized
header if exists.

For other headers added through middleware stack either by
customization or users, it wouldn't affect signing or sending as long
as the request doesn't contain same header names in different casing.
All the internal headers will be consistent. But users should be
careful when they are adding their own headers.

We don't add middleware to lowercase all headers to prevent
alternating the users' customizations.

Ref: aws/aws-sdk-js-v3#1800
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.

SignatureDoesNotMatch while uploading an object to S3 with ContentType
3 participants