Browse files

Corrected quoted string header value preservation

  • Loading branch information...
1 parent 30ad389 commit 0b310ba80c2a70915a390c9d57ebe42f4f04626e Lee Trout committed Mar 4, 2014
Showing with 5 additions and 3 deletions.
  1. +4 −2 boto/auth.py
  2. +1 −1 tests/unit/auth/test_sigv4.py
View
6 boto/auth.py
@@ -358,9 +358,11 @@ def canonical_headers(self, headers_to_sign):
for header in headers_to_sign:
c_name = header.lower().strip()
raw_value = headers_to_sign[header]
- c_value = ' '.join(raw_value.strip().split())
+ if '"' in raw_value:
+ c_value = raw_value.strip()
+ else:
+ c_value = ' '.join(raw_value.strip().split())
canonical.append('%s:%s' % (c_name, c_value))
-
return '\n'.join(sorted(canonical))
def signed_headers(self, headers_to_sign):
View
2 tests/unit/auth/test_sigv4.py
@@ -65,7 +65,7 @@ def test_inner_whitespace_is_collapsed(self):
'host:glacier.us-east-1.amazonaws.com\n'
'x-amz-archive-description:two spaces\n'
'x-amz-glacier-version:2012-06-01\n'
- 'x-amz-quoted-string:"a b c"')
+ 'x-amz-quoted-string:"a b c"')
def test_canonical_query_string(self):
auth = HmacAuthV4Handler('glacier.us-east-1.amazonaws.com',

0 comments on commit 0b310ba

Please sign in to comment.