Commit d0dede7
authored
Refactor
## Motivation and Context
This PR breaks up `RequestChecksumInterceptor` into two interceptors:
`RequestChecksumInterceptor` and `AwsChunkedContentEncodingInterceptor`
with additional code restructuring to support the upcoming aws-chunked
content encoding enhancement.
## Description
`RequestChecksumInterceptor` previously handled two distinct
responsibilities:
1. Adding checksums (body or trailer)
2. Applying aws-chunked content encoding
This refactor extracts the second responsibility (aws-chunked logic)
into `AwsChunkedContentEncodingInterceptor`, aiming to enable it via the
dedicated trait when available in Smithy.
In addition, both interceptors now wrap bodies in
`modify_before_transmit` instead of `modify_before_signing` per design
requirements.
## Tips for merging to `feature/http-1.x`
This refactor reluctantly adds `http_0x` constructs that will conflict
with `feature/http-1.x`. Update these files when merging:
- `aws-inlineable/src/http_request_checksum.rs` - Apply same 1.x updates
as done [in
branch](https://github.com/smithy-lang/smithy-rs/compare/feature/http-1.x?expand=1#diff-7c4006e142da69a7a442cd1d152bf5d0ae05a18c93a02c9754776ef29cef5dcd)
(note: `test_checksum_body_is_retryable` was removed as it tested a
utility only used in streaming cases against non-streaming bodies)
- `aws-inlineable/src/aws_chunked.rs` - Use 1.x for header names,
values, and body trait methods in unit tests, as in
`http_request_checksum.rs`
- `aws/rust-runtime/aws-runtime/src/content_encoding.rs` - Needs 1.x
updates
```
fn size_hint(&self) -> http_body_1x::SizeHint {
http_body_1x::SizeHint::with_exact(self.encoded_length())
}
```
to
```
fn size_hint(&self) -> http_body_1x::SizeHint {
http_body_1x::SizeHint::with_exact(self.options.encoded_length())
}
```
because the `.encoded_length()` method has been moved from
`AwsChunkedBody` to `AwsChunkedBodyOptions` (due to the `content-length`
header needing encoded length during signing but body creation deferred
to
`modify_before_transmit`)
## Testing
- CI
----
_By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice._RequestChecksumInterceptor into distinct interceptors (#4384)1 parent 41ea15d commit d0dede7
File tree
11 files changed
+740
-316
lines changed- aws
- codegen-aws-sdk/src/main/kotlin/software/amazon/smithy/rustsdk
- rust-runtime
- aws-inlineable/src
- aws-runtime
- src
11 files changed
+740
-316
lines changedLines changed: 93 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
| 59 | + | |
59 | 60 | | |
60 | 61 | | |
61 | 62 | | |
| |||
aws/codegen-aws-sdk/src/main/kotlin/software/amazon/smithy/rustsdk/HttpRequestChecksumDecorator.kt
Lines changed: 5 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
58 | 62 | | |
59 | | - | |
| 63 | + | |
60 | 64 | | |
61 | 65 | | |
62 | 66 | | |
| |||
Lines changed: 5 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
24 | 28 | | |
25 | | - | |
| 29 | + | |
26 | 30 | | |
27 | 31 | | |
28 | 32 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
0 commit comments