From c47f50bc6db08fc3a67b493683b27c2e95440f99 Mon Sep 17 00:00:00 2001 From: Devin Ceartas Date: Thu, 3 Sep 2015 13:38:05 -0400 Subject: [PATCH 1/2] Adapt to changes made to module see changes in Thin.pm (localtime -> gmtime) --- t/01-sigv4.t | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/t/01-sigv4.t b/t/01-sigv4.t index 7a181c6..f1fc065 100644 --- a/t/01-sigv4.t +++ b/t/01-sigv4.t @@ -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 @@ -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' ); @@ -71,8 +71,6 @@ is( $string_to_sign, $date ), - 'cbf1de94a5d9f9099dc7114d6083fa852cc7d4e12a93118b429bb6d36334d9c7', + 'ece45cfec339978ebed727d680f6a5d3b7089f52fb7faa3d5741225293d8066f', 'v4 signature created successfully' ); - - From 4fd96536ca20a39434a029e1df7cf61b15585555 Mon Sep 17 00:00:00 2001 From: Devin Ceartas Date: Thu, 3 Sep 2015 13:39:45 -0400 Subject: [PATCH 2/2] Amazon expects GMT times use gmtime, not localtime in formatting date. Change tested in live cloudfront distribution. --- lib/Amazon/CloudFront/Thin.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/Amazon/CloudFront/Thin.pm b/lib/Amazon/CloudFront/Thin.pm index 3e4a60d..c786933 100644 --- a/lib/Amazon/CloudFront/Thin.pm +++ b/lib/Amazon/CloudFront/Thin.pm @@ -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) = @_; @@ -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