Unverified Commit b77c66cb authored by Zelda Hessler's avatar Zelda Hessler Committed by GitHub
Browse files

Feature: add support for aws-chunked content encoding (#1501)



* add: support for unsigned aws-chunked content encoding

* add: aws-smithy-checksums to CrateSet.key

* refactor: API of AwsChunkedBodyOptions
update: AwsChunkedBody to note we only support single chunks
remove: unnecessary `Option`s
remove: overly smart total_length_of_trailers_in_bytes in trailers_as_aws_chunked_bytes
update: use "where"-style declaration for `impl<Inner> Body for AwsChunkedBody<Inner>`
add: helpful data to trace logging
add: trailer len double check in AwsChunkedBody::poll_data
add: test for trailer len double check
add: assert to size_hint
fix: incorrect body emitted when body is empty
add: test for empty encoded body

* Update CHANGELOG.next.toml

Co-authored-by: default avatarJohn DiSanti <jdisanti@amazon.com>

* update: CHANGELOG.next.toml message

* refactor: aws-chunked trailer encoding and size calculation
update: when aws-chunked formatting a `HeaderMap`, header names with multiple values will be written out one value per line
remove: unnecessary AwsChunkedBodyOptions::stream_length method
add: trace fields
refactor: make inserting the final body CRLF more explicit
add: test to ensure trailer encoding and trailer len calculation stay in sync

* udpate: emit error instead of panicking for incorrect trailer length

* add: test ensuring trailer serialization and length calculation stay in sync for empty HeaderMap

* update: avoid repeated allocations in trailers_as_aws_chunked_bytes
fix: don't convert to str before getting len of HeaderValue

* add: aws-chunked body test for inner bodies that emit intermittent chunks
add: double check that stream_length used to create an `AwsChunkedBody` is correct.

Co-authored-by: default avatarJohn DiSanti <jdisanti@amazon.com>
parent e751ed69
Loading
Loading
Loading
Loading
+10 −1
Original line number Diff line number Diff line
@@ -10,3 +10,12 @@
# references = ["smithy-rs#920"]
# meta = { "breaking" = false, "tada" = false, "bug" = false }
# author = "rcoh"

[[aws-sdk-rust]]
message = """
Add support for aws-chunked content encoding. Only single-chunk encoding is supported. Multiple chunks and
chunk signing are not supported at this time.
"""
references = ["smithy-rs#1263"]
meta = { "breaking" = false, "tada" = false, "bug" = false }
author = "Velfi"
+6 −1
Original line number Diff line number Diff line
@@ -11,18 +11,23 @@ repository = "https://github.com/awslabs/smithy-rs"
aws-smithy-http = { path = "../../../rust-runtime/aws-smithy-http" }
aws-smithy-types = { path = "../../../rust-runtime/aws-smithy-types" }
aws-types = { path = "../aws-types" }
bytes = "1.1"
http = "0.2.3"
http-body = "0.4.5"
lazy_static = "1.4.0"
tracing = "0.1"
percent-encoding = "2.1.0"
pin-project-lite = "0.2.9"

[dev-dependencies]
async-trait = "0.1.50"
aws-smithy-async = { path = "../../../rust-runtime/aws-smithy-async", features = ["rt-tokio"] }
aws-smithy-checksums = { path = "../../../rust-runtime/aws-smithy-checksums" }
aws-smithy-protocol-test = { path = "../../../rust-runtime/aws-smithy-protocol-test" }
bytes-utils = "0.1.2"
env_logger = "0.9"
http = "0.2.3"
tokio = { version = "1", features = ["macros", "rt", "rt-multi-thread", "test-util"] }
tokio = { version = "1", features = ["macros", "rt", "rt-multi-thread", "test-util", "time"] }
tracing-subscriber = { version = "0.3.5", features = ["env-filter"] }
proptest = "1"
serde = { version = "1", features = ["derive"]}
+603 −0

File added.

Preview size limit exceeded, changes collapsed.

+3 −0
Original line number Diff line number Diff line
@@ -24,3 +24,6 @@ pub mod retry;

/// User agent middleware
pub mod user_agent;

/// AWS-specific content-encoding tools
pub mod content_encoding;
+1 −0
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@ object CrateSet {
    private val SMITHY_RUNTIME_COMMON = listOf(
        "aws-smithy-async",
        "aws-smithy-client",
        "aws-smithy-checksums",
        "aws-smithy-eventstream",
        "aws-smithy-http",
        "aws-smithy-http-tower",