-
Notifications
You must be signed in to change notification settings - Fork 249
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
GetObject set_checksum_mode does not remove x-amz-checksum-mode header #1246
Comments
Perhaps an additional question: why is checksum mode enabled by default? Is that actually undesirable? Or perhaps the field is indeed actually turned off by default, but somehow getting added to the headers anyway, ignoring the actual field?... |
The default behavior around S3 checksums has recently changed in all AWS SDKs, see the announcement for the Rust SDK at #1240 What you likely want is to set the new option response_checksum_calculation to ResponseChecksumValidation::WhenRequired (see documentation on that enum for more specifics) so that checksums are only validated on operations that require it. |
Thanks, this works:
(My original comment was wrong: I was supposed to be using I am still curious how |
There is some codegenerated logic around mutating that value: https://github.com/smithy-lang/smithy-rs/blob/e41f7d7dfa84b38b1524823bdcac56f0dcc9dddc/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/HttpResponseChecksumDecorator.kt#L155-L176 You can see the closure generated by that code for GetObject below. If aws-sdk-rust/sdk/s3/src/operation/get_object.rs Lines 130 to 156 in f007170
You can see the Smithy spec around this functionality here: https://smithy.io/2.0/aws/aws-core.html#aws-protocols-httpchecksum-trait |
Describe the bug
I need to remove the
x-amz-checksum-mode
header for talking to an s3 compatible data store. I would expectget_object().set_checksum_mode(None)
to achieve this. However, it does not appear to do so. (There is a workaround I give at the bottom, but I would like this SDK to work as I would expect.)I would happily put up a PR to fix this, except
aws-sdk-rust/sdk/s3/src/operation/get_object/builders.rs
Line 718 in f007170
aws-sdk-rust/sdk/s3/src/operation/get_object/_get_object_input.rs
Line 813 in f007170
aws-sdk-rust/sdk/s3/src/protocol_serde/shape_get_object.rs
Line 390 in f007170
Please correct me if I am simply using the wrong function to achieve my goal, or there is some other point that I am missing, thanks.
Regression Issue
Expected Behavior
There is no
x-amx-checksum-mode
header in the request.Current Behavior
The HTTP request headers include
x-amz-checksum-mode = ENABLED
Reproduction Steps
Full repro steps:
cargo new s3checksum cd s3checksum/ cargo add aws_config -F behavior-version-latest cargo add aws_sdk_s3 cargo add tokio -F full
With this main.rs
Will give output like:
Possible Solution
Perhaps somewhere something is overriding the value
set_checksum_mode
sets?Additional Information/Context
There is a workaround:
But that seems like it is doing only exactly what
.set_checksum_mode(None)
should accomplish, I would think. And, tbh, figuring out how to do this was quite unintuitive -- I would prefer that the fn that does the thing, actually does the thing.Version
Environment details (OS name and version, etc.)
WSL2 Ubuntu in windows 11
Logs
No response
The text was updated successfully, but these errors were encountered: