Skip to content

Instantly share code, notes, and snippets.

@me-vlad
Created February 14, 2012 21:06
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save me-vlad/1830439 to your computer and use it in GitHub Desktop.
Save me-vlad/1830439 to your computer and use it in GitHub Desktop.
s3curl.pl (http://aws.amazon.com/code/128): fix x-amz-date and aws endpoints patch
--- s3curl.pl.orig 2011-08-16 22:23:39.000000000 +0300
+++ s3curl.pl 2012-02-14 22:37:01.594635639 +0200
@@ -26,11 +26,14 @@
use constant STAT_UID => 4;
# begin customizing here
+# http://docs.amazonwebservices.com/general/latest/gr/rande.html#s3_region
my @endpoints = ( 's3.amazonaws.com',
+ 's3-us-west-2.amazonaws.com',
's3-us-west-1.amazonaws.com',
's3-eu-west-1.amazonaws.com',
's3-ap-southeast-1.amazonaws.com',
- 's3-ap-northeast-1.amazonaws.com' );
+ 's3-ap-northeast-1.amazonaws.com',
+ 's3-sa-east-1.amazonaws.com' );
my $CURL = "curl";
@@ -212,6 +215,9 @@
$xamzHeadersToSign .= "$_:$headerValue\n";
}
+# x-amz-date header workaround
+setlocale(LC_TIME, "C");
+
my $httpDate = POSIX::strftime("%a, %d %b %Y %H:%M:%S +0000", gmtime );
my $stringToSign = "$method\n$contentMD5\n$contentType\n$httpDate\n$xamzHeadersToSign$resource";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment