adamsb6/s3_file — pull request #11 by AlainODea (2013-05-17 03:14:58+00:00)
Title: Avoid re-download for multi-part uploads

Multi-part S3 uploads do not put the MD5 of the content in the ETag header. In
order to allow users to prevent re-download of these objects I added support
for User-Defined Metadata that provides the hash. If x-amz-meta-digest is
provided it is processed as if it were a Digest header (RFC 3230).

For example an S3 Object might have the following properties:
ETag: 680835367a1c3033acedf7469692b568-2
x-amz-meta-digest: md5=79a5b8d7c02d8debba0432b6b48e9baf,SHA=7c31939ca9adfc3fd989e2c8af5ab8fe589aa795

The MD5 of the local file will be checked against the MD5 from
x-amz-meta-digest if it is present. It will take precedence over the ETag.

I also refactored methods to share common time and auth string generation.

Fixed the handling of digest being nil. Just needed a quick ternary to return an empty hash. It was the lowest ugliness solution I could think of :)