-
Notifications
You must be signed in to change notification settings - Fork 193
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
Add a RuntimePlugin/Interceptor to enforce expected content length #3491
Conversation
A new generated diff is ready to view.
A new doc preview is ready to view. |
fcb33cd
to
dcb0c0a
Compare
A new generated diff is ready to view.
A new doc preview is ready to view. |
A new generated diff is ready to view.
A new doc preview is ready to view. |
#[pin] | ||
body: InnerBody, | ||
expected_length: u64, | ||
remaining_length: i64, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The u64/i64 difference with all the casting seems fragile to me. Why not just do a checked subtraction and error out if it would go below zero? Or, alternatively, change this from "remaining" to "received" and use addition instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good idea! that lead to a nice simplification
A new generated diff is ready to view.
A new doc preview is ready to view. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! 🚀
d3dacb3
to
9be92d9
Compare
A new generated diff is ready to view.
A new doc preview is ready to view. |
A new generated diff is ready to view.
A new doc preview is ready to view. |
A new generated diff is ready to view.
A new doc preview is ready to view. |
A new generated diff is ready to view.
A new doc preview is ready to view. |
88a1301
to
2fad245
Compare
A new generated diff is ready to view.
A new doc preview is ready to view. |
Precommit hooks and CI have started failing due to `runtime-versioner` reporting `aws-config` requires a version bump. While the most recent change to that crate was made by [this PR](#3491) only updating test-related code, it does still require a version bump. ---- _By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice._
## Motivation and Context This PR re-enables content-length runtime plugin that was previously disabled due to some erroneous tests. Those [tests](https://github.com/awslabs/aws-sdk-rust/blob/main/sdk/dynamodb/tests/retries-with-client-rate-limiting.rs#L29) appear to be fixed. Original PR: #3491 Tracking issue: #3523 ## Checklist <!--- If a checkbox below is not applicable, then please DELETE it rather than leaving it unchecked --> - [x] I have updated `CHANGELOG.next.toml` if I made changes to the smithy-rs codegen or runtime crates ---- _By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice._
Motivation and Context
There is a rarely-triggered bug (awslabs/aws-sdk-rust#1079) that can occur when the runtime is dropped between requests. Although this is definitely the wrong thing to do(tm) which should still aim to at least protect the users from bad data in this case.
This adds an interceptor which validates that the body returned is the correct length.
Description
Testing
Checklist
CHANGELOG.next.toml
if I made changes to the smithy-rs codegen or runtime cratesBy submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.