libcloud-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anthonys...@apache.org
Subject [5/9] libcloud git commit: Add missing X-AMZ-Content-SHA256 header
Date Tue, 09 Feb 2016 04:13:20 GMT
Add missing X-AMZ-Content-SHA256 header

Missing X-AMZ-Content-SHA256 header can occur 400 bad request
on several service such as S3


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/27074aa5
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/27074aa5
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/27074aa5

Branch: refs/heads/trunk
Commit: 27074aa5d85e2e687f156272ba433033190ee318
Parents: e4f5fbf
Author: Geunwoo Shin <encyphered@gmail.com>
Authored: Wed Jan 27 23:51:40 2016 +0900
Committer: anthony-shaw <anthony.p.shaw@gmail.com>
Committed: Tue Feb 9 15:12:48 2016 +1100

----------------------------------------------------------------------
 libcloud/common/aws.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/27074aa5/libcloud/common/aws.py
----------------------------------------------------------------------
diff --git a/libcloud/common/aws.py b/libcloud/common/aws.py
index e0a673a..74922a6 100644
--- a/libcloud/common/aws.py
+++ b/libcloud/common/aws.py
@@ -252,6 +252,7 @@ class AWSRequestSignerAlgorithmV4(AWSRequestSigner):
                             data=None):
         now = datetime.utcnow()
         headers['X-AMZ-Date'] = now.strftime('%Y%m%dT%H%M%SZ')
+        headers['X-AMZ-Content-SHA256'] = self._get_payload_hash(method, data)
         headers['Authorization'] = \
             self._get_authorization_v4_header(params=params, headers=headers,
                                               dt=now, method=method, path=path,
@@ -361,7 +362,7 @@ class SignedAWSConnection(AWSTokenConnection):
 
         if self.signature_version == '2':
             signer_cls = AWSRequestSignerAlgorithmV2
-        elif signature_version == '4':
+        elif self.signature_version == '4':
             signer_cls = AWSRequestSignerAlgorithmV4
         else:
             raise ValueError('Unsupported signature_version: %s' %


Mime
View raw message