1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

Merge pull request #1137 from fcheung/idempotent_s3

[AWS|Storage] Mark upload_part as idempotent s3
This commit is contained in:
Frederick Cheung 2012-09-10 09:26:26 -07:00
commit eb700e681f
2 changed files with 3 additions and 1 deletions

View file

@ -173,7 +173,8 @@ module Fog
# TODO: Support large chunk sizes without reading the chunk into memory
body.rewind if body.respond_to?(:rewind)
while (chunk = body.read(multipart_chunk_size)) do
part_upload = connection.upload_part(directory.key, key, upload_id, part_tags.size + 1, chunk )
md5 = Base64.encode64(Digest::MD5.digest(chunk)).strip
part_upload = connection.upload_part(directory.key, key, upload_id, part_tags.size + 1, chunk, 'Content-MD5' => md5 )
part_tags << part_upload.headers["ETag"]
end

View file

@ -29,6 +29,7 @@ module Fog
request({
:body => data[:body],
:expects => 200,
:idempotent => true,
:headers => headers,
:host => "#{bucket_name}.#{@host}",
:method => 'PUT',