Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix - Amazon expects GMT #2

Merged
merged 2 commits into from Sep 3, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/Amazon/CloudFront/Thin.pm
Expand Up @@ -9,7 +9,7 @@ use HTTP::Date ();
use HTTP::Request ();
use Digest::SHA ();

our $VERSION = '0.02';
our $VERSION = '0.03';

sub new {
my ($class, @extra) = @_;
Expand Down Expand Up @@ -110,7 +110,7 @@ sub _cloudfront_scope {

sub _format_date {
my ($time) = @_;
my @date = localtime $time;
my @date = gmtime $time;
$date[5] += 1900; # fix the year
$date[4] += 1; # fix the month

Expand Down
8 changes: 3 additions & 5 deletions t/01-sigv4.t
Expand Up @@ -43,7 +43,7 @@ POST
content-length:312
content-type:text/xml
host:cloudfront.amazonaws.com
x-amz-date:20150807T153442Z
x-amz-date:20150807T183442Z

content-length;content-type;host;x-amz-date
64b09f3f2181c5d78ac37f12611e5a9ca0269a2da1dd515e8828e6165a8da029
Expand All @@ -54,7 +54,7 @@ is $canonical_request, $expected, 'canonical request created successfully';

is(
Digest::SHA::sha256_hex($canonical_request),
'0e440187931192e5722a7c5f33e1d50fdca88abd548cb0963edcf7a4a991568f',
'd5c52539eb683e5b92c772bb271f74ce8f324be1f7019c64f839fa622f6cfb58',
'sha256 matches canonical request'
);

Expand All @@ -71,8 +71,6 @@ is(
$string_to_sign,
$date
),
'cbf1de94a5d9f9099dc7114d6083fa852cc7d4e12a93118b429bb6d36334d9c7',
'ece45cfec339978ebed727d680f6a5d3b7089f52fb7faa3d5741225293d8066f',
'v4 signature created successfully'
);