boto/botocore — pull request #399 by jamesls (2014-12-05 00:26:10+00:00)
Title: Always set the Date header to the current date

This fixes a bug where if you resend a request and resign
it without changing the date, you can get an auth error
that your signature is too old if the retry loops fall outside
the auth window (~15 minutes).

What was happening is that we were retrying a failed S3 request,
but because we weren't re-setting the Date header, eventually
the retried request would have a signature that was too old.

I also had to update this for sigv4, but it's a little more complicated.

Part of the reason this change looks more complicated than
you would expect is because we use the sigv4 test suite
(http://docs.aws.amazon.com/general/latest/gr/signature-v4-test-suite.html)
to test our implementation. However, these tests use a Date header
whereas previous versions used an X-Amz-Date.

We can possibly investigate always using Date instead of X-Amz-Date,
but we'd need to make sure we aren't introducing any regressions.

cc @danielgtaylor @kyleknap