Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions gems/aws-sdk-core/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
Unreleased Changes
------------------

* Issue - Preserve existing Content-Encoding when applying request trailer checksum.

3.241.1 (2026-01-06)
------------------

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
12 changes: 12 additions & 0 deletions gems/aws-sdk-s3/spec/plugins/checksum_algorithm_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,18 @@ module Plugins
end
end

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')
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(
Expand Down
Loading