Fix SignedHeaders
Without this patch:
Signed headers: accept-encoding;content-type;host;user-agent;x-amz-content-sha256;x-amz-date;x-amz-acl;x-amz-meta-created;x-amz-meta-owner;x-amz-storage-class
With this patch:
Signed headers: accept-encoding;content-type;host;user-agent;x-amz-acl;x-amz-content-sha256;x-amz-date;x-amz-meta-created;x-amz-meta-owner;x-amz-storage-class
The sort was done on headers with upper/lower case, this patch fix this
beahiavor.
@@ -347,14 +347,15 @@ class AWSRequestSignerAlgorithmV4(AWSRequestSigner):
)
def _get_signed_headers(self, headers):
- return ";".join([k.lower() for k in sorted(headers.keys())])
+ return ";".join([k.lower()
+ for k in sorted(headers.keys(), key=str.lower)])
def _get_canonical_headers(self, headers):
return (
"\n".join(
[
":".join([k.lower(), str(v).strip()])
- for k, v in sorted(headers.items())
+ for k, v in sorted(headers.items(), key=lambda k: k[0].lower())
]
)
+ "\n"
