Take into account additional headers in cp and sync commands. #86

Open
wants to merge 1 commit into
from

Conversation

Projects
None yet
2 participants
@bladealslayer

Support for condition headers.

It is useful for the cp/sync command to support the extra headers, because conditions such as x-amz-copy-source-if-modified-since can be given.
PreconditionFailed errors need to be accounted for in responses, as these are normal when conditions are specified.

Example usage:

s3cmd cp -r -v --add-header "x-amz-copy-source-if-modified-since:date -u -d '1 hour ago' | cut -d\ -f 1-4,6" s3://source-bucket/ s3://dest-bucket/

Take into account additional headers in cp and sync commands. Support…
… for condition headers.

It is useful for the cp/sync command to support the extra headers, because conditions such as x-amz-copy-source-if-modified-since can be given.
PreconditionFailed errors need to be accounted for in responses, as these are normal when conditions are specified.
@mdomsch

This comment has been minimized.

Show comment Hide comment
@mdomsch

mdomsch Dec 6, 2012

I need to understand why extra_headers had been commented out in object_copy(). Same question applies to s3tools#94 which touches similar code.

What is magic response status number 412? Can we have that defined somewhere? Simply saying "skipping" doesn't tell me anything. Please be more explicit here.

Thanks,
Matt

mdomsch commented on 62453b0 Dec 6, 2012

I need to understand why extra_headers had been commented out in object_copy(). Same question applies to s3tools#94 which touches similar code.

What is magic response status number 412? Can we have that defined somewhere? Simply saying "skipping" doesn't tell me anything. Please be more explicit here.

Thanks,
Matt

This comment has been minimized.

Show comment Hide comment
@bladealslayer

bladealslayer Dec 6, 2012

Owner

Hi,

I have no idea why extra_headers was originally commented out. I tracked it to e0b946c, but it seems to me it was commented out for no real reason. Maybe it was temporary change that made it into the commit by mistake?

The 412 is a response code, as documented in Amazon's S3 API reference: http://docs.amazonwebservices.com/AmazonS3/latest/API/RESTObjectCOPY.html. It is normally returned when condition (in the extra headers) for an object copy is false.

As far as the output goes, a more explicit might be "Skipping unchanged file..." - that fits the x-amz-copy-source-if-modified-since header, but might not be very informative, if other conditions are supplied. Still x-amz-copy-source-if-modified-since is probably the most useful condition.

Cheers,
Boyan

Owner

bladealslayer replied Dec 6, 2012

Hi,

I have no idea why extra_headers was originally commented out. I tracked it to e0b946c, but it seems to me it was commented out for no real reason. Maybe it was temporary change that made it into the commit by mistake?

The 412 is a response code, as documented in Amazon's S3 API reference: http://docs.amazonwebservices.com/AmazonS3/latest/API/RESTObjectCOPY.html. It is normally returned when condition (in the extra headers) for an object copy is false.

As far as the output goes, a more explicit might be "Skipping unchanged file..." - that fits the x-amz-copy-source-if-modified-since header, but might not be very informative, if other conditions are supplied. Still x-amz-copy-source-if-modified-since is probably the most useful condition.

Cheers,
Boyan

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment