Skip to content

Commit

Permalink
Merge pull request #2 from NacreData/bugfix
Browse files Browse the repository at this point in the history
Bugfix - Amazon expects GMT
  • Loading branch information
garu committed Sep 3, 2015
2 parents 8f1b6f2 + 4fd9653 commit 2de4ca4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
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'
);


0 comments on commit 2de4ca4

Please sign in to comment.