smithy-lang / smithy-rs

Code generation for the AWS SDK for Rust, as well as server and generic smithy client generation.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add a body wrapper that validates the returned length against content length

rcoh opened this issue · comments

Although Hyper attempts to protect against this case, in general it is possible for our HTTP client to return bodies that are shorter (or longer!) than we expect.

In this case, we should return an error to the customer (rather than happily returning obviously wrong data).

This should be handled by wrapping the body in a body wrapper that is constructed based on the content length returned from the server (similar to how checksum wrapping works today).

Unlike checksums, this would always be installed.

Implemented in #3491

Looks like the fix was disabled due to #3523