smithy-rs/rust-runtime
Zelda Hessler 1cecc3baa6
Fix request compression (#3820)
## Description
<!--- Describe your changes in detail -->
This PR includes several fixes for request compression:
- `aws_smithy_compression::body::compress::CompressedBody` will no
longer incorrectly return the inner body's `SizeHint`, returning
`SizeHint::default()` instead.
- Fixed a bug where compressed payloads would have an incorrect content
length, causing those requests to hang.
- Compress in-memory request payloads instead of the previous lazy
approach.

## Testing
<!--- Please describe in detail how you tested your changes -->
<!--- Include details of your testing environment, and the tests you ran
to -->
<!--- see how your change affects other areas of the code, etc. -->
Tests are included. Additionally, I ran a reproducer for a user issues
to ensure that their use case works:

```
#[tokio::test]
async fn use_case_reproducer() {
    tracing_subscriber::fmt::init();
    let shared_config = aws_config::from_env()
        .region(aws_sdk_cloudwatch::config::Region::new("us-west-2"))
        .load()
        .await;
    let service_config = aws_sdk_cloudwatch::config::Config::from(&shared_config)
        .to_builder()
        .request_min_compression_size_bytes(1)
        .build();
    let client = Client::from_conf(service_config);

    tracing::info!("sending metrics...");
    client
        .put_metric_data()
        .namespace("CloudWatchTestMetricsBrivinc")
        .metric_data(
            aws_sdk_cloudwatch::types::MetricDatum::builder()
                .metric_name(format!("MyMetricNameIsALittleLong"))
                .value(0.0)
                .build(),
        )
        .send()
        .await
        .unwrap();
}
``` 

----

_By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice._

---------

Co-authored-by: ysaito1001 <awsaito@amazon.com>
2024-09-18 17:06:58 +00:00
..
aws-smithy-async Sourcing service config from the environment. (#3493) 2024-04-01 14:50:31 +00:00
aws-smithy-cbor Add client-support for RPC v2 CBOR (#3767) 2024-07-31 19:22:03 +00:00
aws-smithy-checksums Delete nonprintable characters from aws-smithy-checksums test (#3778) 2024-08-07 15:39:14 +00:00
aws-smithy-client Independently version deprecated runtime crates (#3364) 2024-01-16 18:36:30 +00:00
aws-smithy-compression Fix request compression (#3820) 2024-09-18 17:06:58 +00:00
aws-smithy-eventstream Update lockfiles (#3821) 2024-09-06 17:57:59 +00:00
aws-smithy-experimental backport connection poisoning to hyper 1.x client (#3795) 2024-08-21 12:46:35 +00:00
aws-smithy-http Update lockfiles (#3821) 2024-09-06 17:57:59 +00:00
aws-smithy-http-auth Independently version deprecated runtime crates (#3364) 2024-01-16 18:36:30 +00:00
aws-smithy-http-server Upgrade MSRV to 1.78.0 (#3800) 2024-08-27 15:30:40 +00:00
aws-smithy-http-server-python Update lockfiles (#3821) 2024-09-06 17:57:59 +00:00
aws-smithy-http-server-typescript Independently version all runtime crates (#3448) 2024-02-28 22:35:28 +00:00
aws-smithy-http-tower Independently version deprecated runtime crates (#3364) 2024-01-16 18:36:30 +00:00
aws-smithy-json Independently version all runtime crates (#3448) 2024-02-28 22:35:28 +00:00
aws-smithy-mocks-experimental Sourcing service config from the environment. (#3493) 2024-04-01 14:50:31 +00:00
aws-smithy-protocol-test Add client-support for RPC v2 CBOR (#3767) 2024-07-31 19:22:03 +00:00
aws-smithy-query Independently version all runtime crates (#3448) 2024-02-28 22:35:28 +00:00
aws-smithy-runtime Upgrade MSRV to 1.78.0 (#3800) 2024-08-27 15:30:40 +00:00
aws-smithy-runtime-api Improve HTTP header errors (#3779) 2024-08-07 22:20:08 +00:00
aws-smithy-types Fix request compression (#3820) 2024-09-18 17:06:58 +00:00
aws-smithy-types-convert Update to remove use of deprecated method (#3468) 2024-03-06 20:03:39 +00:00
aws-smithy-wasm expose connector in user agent (#3667) 2024-06-12 16:14:15 +00:00
aws-smithy-xml Update lockfiles (#3821) 2024-09-06 17:57:59 +00:00
inlineable Fix request compression (#3820) 2024-09-18 17:06:58 +00:00
.gitignore Adding new gradle tasks for generating Cargo.lock (#3689) 2024-06-16 02:59:53 +00:00
Cargo.lock Fix request compression (#3820) 2024-09-18 17:06:58 +00:00
Cargo.toml Add server RPC v2 CBOR support (#2544) 2024-07-17 09:50:52 +00:00
build.gradle.kts Fix the build against JDK 20 (#3323) 2023-12-15 16:18:36 +00:00
clippy.toml Add clippy.toml with forbidden methods & fix SystemTime usages (#2882) 2023-07-28 17:16:44 +00:00