From af937ba285e4db0ca9cf7f3ab200d51529c37e3e Mon Sep 17 00:00:00 2001 From: Juli Tera Date: Tue, 6 Jan 2026 13:59:20 -0800 Subject: [PATCH 1/4] Fix content encoding in trailer impl --- .../lib/aws-sdk-core/plugins/checksum_algorithm.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/gems/aws-sdk-core/lib/aws-sdk-core/plugins/checksum_algorithm.rb b/gems/aws-sdk-core/lib/aws-sdk-core/plugins/checksum_algorithm.rb index 31e2010b546..c172ef678d0 100644 --- a/gems/aws-sdk-core/lib/aws-sdk-core/plugins/checksum_algorithm.rb +++ b/gems/aws-sdk-core/lib/aws-sdk-core/plugins/checksum_algorithm.rb @@ -381,7 +381,12 @@ def apply_request_trailer_checksum(context, headers, checksum_properties) location_name = checksum_properties[:name] # set required headers - headers['Content-Encoding'] = 'aws-chunked' + headers['Content-Encoding'] = + if headers['Content-Encoding'] + headers['Content-Encoding'] += ', aws-chunked' + else + 'aws-chunked' + end headers['X-Amz-Content-Sha256'] = 'STREAMING-UNSIGNED-PAYLOAD-TRAILER' headers['X-Amz-Trailer'] = location_name From 152a87f84eca7033757fda34eb5be1f3b13d0640 Mon Sep 17 00:00:00 2001 From: Juli Tera Date: Tue, 6 Jan 2026 14:15:13 -0800 Subject: [PATCH 2/4] Add tests --- gems/aws-sdk-core/CHANGELOG.md | 2 ++ .../spec/plugins/checksum_algorithm_spec.rb | 12 ++++++++++++ 2 files changed, 14 insertions(+) diff --git a/gems/aws-sdk-core/CHANGELOG.md b/gems/aws-sdk-core/CHANGELOG.md index 82d5d71ba75..d1c1a063612 100644 --- a/gems/aws-sdk-core/CHANGELOG.md +++ b/gems/aws-sdk-core/CHANGELOG.md @@ -1,6 +1,8 @@ Unreleased Changes ------------------ +* Issue - Preserve existing Content-Encoding when applying trailer checksum. + 3.241.1 (2026-01-06) ------------------ diff --git a/gems/aws-sdk-s3/spec/plugins/checksum_algorithm_spec.rb b/gems/aws-sdk-s3/spec/plugins/checksum_algorithm_spec.rb index 3590e860294..16fc26234b3 100644 --- a/gems/aws-sdk-s3/spec/plugins/checksum_algorithm_spec.rb +++ b/gems/aws-sdk-s3/spec/plugins/checksum_algorithm_spec.rb @@ -111,6 +111,18 @@ module Plugins end end + context 'trailer checksum' do + it 'sets aws-chunked when no existing Content-Encoding header' do + resp = client.put_object(bucket: bucket, key: key, body: body) + expect(resp.context.http_request.headers['Content-Encoding']).to eq('aws-chunked') + end + + it 'appends aws-chunked to existing Content-Encoding header' do + resp = client.put_object(bucket: bucket, key: key, body: body, content_encoding: 'gzip') + expect(resp.context.http_request.headers['Content-Encoding']).to eq('gzip, aws-chunked') + end + end + context 'AwsChunkedTrailerDigestIO' do let(:subject) do ChecksumAlgorithm::AwsChunkedTrailerDigestIO.new( From 71a06435da9f0fc9c7297d2e70d86799239ca0e0 Mon Sep 17 00:00:00 2001 From: Juli Tera Date: Tue, 6 Jan 2026 14:16:40 -0800 Subject: [PATCH 3/4] Update wording --- gems/aws-sdk-core/CHANGELOG.md | 2 +- gems/aws-sdk-s3/spec/plugins/checksum_algorithm_spec.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gems/aws-sdk-core/CHANGELOG.md b/gems/aws-sdk-core/CHANGELOG.md index d1c1a063612..2ab142725be 100644 --- a/gems/aws-sdk-core/CHANGELOG.md +++ b/gems/aws-sdk-core/CHANGELOG.md @@ -1,7 +1,7 @@ Unreleased Changes ------------------ -* Issue - Preserve existing Content-Encoding when applying trailer checksum. +* Issue - Preserve existing Content-Encoding when applying request trailer checksum. 3.241.1 (2026-01-06) ------------------ diff --git a/gems/aws-sdk-s3/spec/plugins/checksum_algorithm_spec.rb b/gems/aws-sdk-s3/spec/plugins/checksum_algorithm_spec.rb index 16fc26234b3..3e19bf79a19 100644 --- a/gems/aws-sdk-s3/spec/plugins/checksum_algorithm_spec.rb +++ b/gems/aws-sdk-s3/spec/plugins/checksum_algorithm_spec.rb @@ -111,7 +111,7 @@ module Plugins end end - context 'trailer checksum' do + context 'request trailer checksum' do it 'sets aws-chunked when no existing Content-Encoding header' do resp = client.put_object(bucket: bucket, key: key, body: body) expect(resp.context.http_request.headers['Content-Encoding']).to eq('aws-chunked') From b293d602032625168594dfe3a8c1b0f6af296d2c Mon Sep 17 00:00:00 2001 From: Juli Tera Date: Wed, 7 Jan 2026 06:51:24 -0800 Subject: [PATCH 4/4] Skip tests for JRUBY --- gems/aws-sdk-s3/spec/plugins/checksum_algorithm_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gems/aws-sdk-s3/spec/plugins/checksum_algorithm_spec.rb b/gems/aws-sdk-s3/spec/plugins/checksum_algorithm_spec.rb index 3e19bf79a19..d3452c6e462 100644 --- a/gems/aws-sdk-s3/spec/plugins/checksum_algorithm_spec.rb +++ b/gems/aws-sdk-s3/spec/plugins/checksum_algorithm_spec.rb @@ -111,7 +111,7 @@ module Plugins end end - context 'request trailer checksum' do + context 'request trailer checksum', skip: defined?(JRUBY_VERSION) do it 'sets aws-chunked when no existing Content-Encoding header' do resp = client.put_object(bucket: bucket, key: key, body: body) expect(resp.context.http_request.headers['Content-Encoding']).to eq('aws-chunked')