S3Sync.net

General Category => Report Bugs => Topic started by: ferrix on June 23, 2008, 02:25:46 PM



Title: Should use Content-MD5 header on PUT
Post by: ferrix on June 23, 2008, 02:25:46 PM
Especially in light of http://developer.amazonwebservices.com/connect/thread.jspa?threadID=22709


Title: Re: Should use Content-MD5 header on PUT
Post by: tienshiao on July 24, 2008, 03:14:41 AM
I've added support for the Content-MD5 header. It seems to work OK for me.

Edit: in case people missed it, the patch is attached to the reply. You might need to be logged in to see it.


Title: Re: Should use Content-MD5 header on PUT
Post by: ferrix on July 24, 2008, 05:01:29 PM
Warning: the patch is backwards.


Title: Re: Should use Content-MD5 header on PUT
Post by: ferrix on July 24, 2008, 05:05:55 PM
Is there any reason you have done
Quote
Base64.encode64(md5.digest)

rather than
Quote
md5.hexdigest

or maybe I don't understand the difference properly..?


Title: Re: Should use Content-MD5 header on PUT
Post by: tienshiao on July 24, 2008, 05:45:47 PM
Oops, sorry about the backwards patch.

hexdigest returns the MD5 in hexidecimal representation [0-9A-F].

Amazon's docs specify Content-MD5 should be in base64 (http://en.wikipedia.org/wiki/Base64) .



In hindsight, there probably isn't a need for the commandline switch (--content-md5). There isn't a good reason not to use Content-MD5 if you're already calculating the MD5.


Title: Re: Should use Content-MD5 header on PUT
Post by: ferrix on July 25, 2008, 05:02:39 PM
I agree about the switch.  I know I need to add this feature.


Title: Re: Should use Content-MD5 header on PUT
Post by: ferrix on July 29, 2008, 12:47:02 AM
When I add this, I want it to be compatible with the --no-md5 option, so that when a transfer is needed it will calculate the md5 anyway (but not bother for just comparing the two trees)