mirror of
https://github.com/fog/fog-aws.git
synced 2022-11-09 13:50:52 -05:00
Fix blank content-encoding when none is supplied
Signature v4 requires that we insert a content-encoding header when doing a streaming upload. If there is no pre-existing content encoding we should set it to identity or some client may be confused by a blank content encoding
This commit is contained in:
parent
8f537d2840
commit
9b9faf6818
1 changed files with 5 additions and 2 deletions
|
@ -561,9 +561,12 @@ module Fog
|
|||
params[:headers]['x-amz-content-sha256'] = 'STREAMING-AWS4-HMAC-SHA256-PAYLOAD'
|
||||
params[:headers]['x-amz-decoded-content-length'] = params[:headers].delete 'Content-Length'
|
||||
|
||||
encoding = "aws-chunked"
|
||||
if params[:headers]['Content-Encoding']
|
||||
encoding = "aws-chunked, #{params[:headers]['Content-Encoding']}"
|
||||
else
|
||||
encoding = "aws-chunked, identity"
|
||||
end
|
||||
|
||||
encoding += ", #{params[:headers]['Content-Encoding']}" if params[:headers]['Content-Encoding']
|
||||
params[:headers]['Content-Encoding'] = encoding
|
||||
else
|
||||
params[:headers]['x-amz-content-sha256'] ||= Digest::SHA256.hexdigest(params[:body] || '')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue