libcloud-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From to...@apache.org
Subject svn commit: r1196699 - /libcloud/trunk/libcloud/compute/drivers/ec2.py
Date Wed, 02 Nov 2011 17:07:29 GMT
Author: tomaz
Date: Wed Nov  2 17:07:28 2011
New Revision: 1196699

URL: http://svn.apache.org/viewvc?rev=1196699&view=rev
Log:
Fix the request signature generation in the base EC2 compute driver. If the
endpoint is using a non-standard port, append it to the hostname used to
generate the signature. Patch has been contributed by Simon Delamare <simon dot
delamare at ens-lyon dot fr> and is part of LIBCLOUD-125.

Modified:
    libcloud/trunk/libcloud/compute/drivers/ec2.py

Modified: libcloud/trunk/libcloud/compute/drivers/ec2.py
URL: http://svn.apache.org/viewvc/libcloud/trunk/libcloud/compute/drivers/ec2.py?rev=1196699&r1=1196698&r2=1196699&view=diff
==============================================================================
--- libcloud/trunk/libcloud/compute/drivers/ec2.py (original)
+++ libcloud/trunk/libcloud/compute/drivers/ec2.py Wed Nov  2 17:07:28 2011
@@ -225,7 +225,12 @@ class EC2Connection(ConnectionUserAndKey
                          urllib.quote(params[key], safe='-_~'))
 
         qs = '&'.join(pairs)
-        string_to_sign = '\n'.join(('GET', self.host, path, qs))
+
+        hostname = self.host
+        if (self.secure and self.port != 443) or (not self.secure and self.port != 80):
+            hostname += ":" + str(self.port)
+
+        string_to_sign = '\n'.join(('GET', hostname, path, qs))
 
         b64_hmac = base64.b64encode(
             hmac.new(secret_key, string_to_sign, digestmod=sha256).digest()



Mime
View raw message