diff options
author | Daniel Lindsley <daniel@toastdriven.com> | 2014-01-06 14:21:48 -0800 |
---|---|---|
committer | Daniel Lindsley <daniel@toastdriven.com> | 2014-01-06 14:21:48 -0800 |
commit | 487ea4e04f35f6a1d7c7d3a1850466e3ed95a440 (patch) | |
tree | 438f28e778740d5e1a5ac6d0beff5fa8c5a90dc5 | |
parent | 06a3daea5e1c6e19ac43a09593ff2a7885dd8478 (diff) | |
parent | 541523113110c699def544309c2ad06e6eba33ff (diff) | |
download | boto-487ea4e04f35f6a1d7c7d3a1850466e3ed95a440.tar.gz |
Merge branch 'hotfix-2.22.1'2.22.1
-rw-r--r-- | README.rst | 4 | ||||
-rw-r--r-- | boto/__init__.py | 2 | ||||
-rw-r--r-- | boto/auth.py | 5 | ||||
-rw-r--r-- | boto/resultset.py | 3 | ||||
-rw-r--r-- | docs/source/index.rst | 1 | ||||
-rw-r--r-- | docs/source/releasenotes/v2.22.1.rst | 22 | ||||
-rw-r--r-- | tests/unit/auth/test_sigv4.py | 19 | ||||
-rw-r--r-- | tests/unit/ec2/test_spotinstance.py | 3 |
8 files changed, 54 insertions, 5 deletions
@@ -1,9 +1,9 @@ #### boto #### -boto 2.22.0 +boto 2.22.1 -Released: 2-January-2014 +Released: 6-January-2014 .. image:: https://travis-ci.org/boto/boto.png?branch=develop :target: https://travis-ci.org/boto/boto diff --git a/boto/__init__.py b/boto/__init__.py index 69a89e84..d2ae4e58 100644 --- a/boto/__init__.py +++ b/boto/__init__.py @@ -37,7 +37,7 @@ import logging.config import urlparse from boto.exception import InvalidUriError -__version__ = '2.22.0' +__version__ = '2.22.1' Version = __version__ # for backware compatibility # http://bugs.python.org/issue7980 diff --git a/boto/auth.py b/boto/auth.py index 0f8b10ce..ba4f9508 100644 --- a/boto/auth.py +++ b/boto/auth.py @@ -534,7 +534,10 @@ class S3HmacAuthV4Handler(HmacAuthV4Handler, AuthHandler): # S3 does **NOT** do path normalization that SigV4 typically does. # Urlencode the path, **NOT** ``auth_path`` (because vhosting). path = urlparse.urlparse(http_request.path) - encoded = urllib.quote(path.path) + # Because some quoting may have already been applied, let's back it out. + unquoted = urllib.unquote(path.path) + # Requote, this time addressing all characters. + encoded = urllib.quote(unquoted) return encoded def host_header(self, host, http_request): diff --git a/boto/resultset.py b/boto/resultset.py index ae4e3684..83052582 100644 --- a/boto/resultset.py +++ b/boto/resultset.py @@ -119,6 +119,9 @@ class ResultSet(list): self.next_token = value elif name == 'nextToken': self.next_token = value + # Code exists which expects nextToken to be available, so we + # set it here to remain backwards-compatibile. + self.nextToken = value elif name == 'BoxUsage': try: connection.box_usage += float(value) diff --git a/docs/source/index.rst b/docs/source/index.rst index b970b349..be44098b 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -116,6 +116,7 @@ Release Notes .. toctree:: :titlesonly: + releasenotes/v2.22.1 releasenotes/v2.22.0 releasenotes/v2.21.2 releasenotes/v2.21.1 diff --git a/docs/source/releasenotes/v2.22.1.rst b/docs/source/releasenotes/v2.22.1.rst new file mode 100644 index 00000000..0fe7aafc --- /dev/null +++ b/docs/source/releasenotes/v2.22.1.rst @@ -0,0 +1,22 @@ +boto v2.22.1 +============ + +:date: 2014/01/06 + +This release fixes working with keys with special characters in them while using +Signature V4 with Amazon Simple Storage Service (S3). It also fixes a regression +in the ``ResultSet`` object, re-adding the ``nextToken`` attribute. This was +most visible from within Amazon Elastic Compute Cloud (EC2) when calling the +``get_spot_price_history`` method. + +Users in the cn-north-1 region or who make active use of +``get_spot_price_history`` are recommended to upgrade. + + +Bugfixes +-------- + +* Fixed key names with special characters in S3 when using SigV4. + (:sha:`8b37180`) +* Re-added the ``nextToken`` attribute to the EC2 result set object. + (:issue:`1968`, :sha:`6928928`) diff --git a/tests/unit/auth/test_sigv4.py b/tests/unit/auth/test_sigv4.py index 2c98e9bd..86d21f1d 100644 --- a/tests/unit/auth/test_sigv4.py +++ b/tests/unit/auth/test_sigv4.py @@ -346,6 +346,25 @@ class TestS3HmacAuthV4Handler(unittest.TestCase): qs = self.auth.canonical_query_string(self.awesome_bucket_request) self.assertEqual(qs, 'max-keys=0') + def test_correct_handling_of_plus_sign(self): + request = HTTPRequest( + 'GET', 'https', 's3-us-west-2.amazonaws.com', 443, + 'hello+world.txt', None, {}, + {}, '' + ) + canonical_uri = self.auth.canonical_uri(request) + # Ensure that things are properly quoted. + self.assertEqual(canonical_uri, 'hello%2Bworld.txt') + + request = HTTPRequest( + 'GET', 'https', 's3-us-west-2.amazonaws.com', 443, + 'hello%2Bworld.txt', None, {}, + {}, '' + ) + canonical_uri = self.auth.canonical_uri(request) + # Verify double escaping hasn't occurred. + self.assertEqual(canonical_uri, 'hello%2Bworld.txt') + def test_mangle_path_and_params(self): request = HTTPRequest( method='GET', diff --git a/tests/unit/ec2/test_spotinstance.py b/tests/unit/ec2/test_spotinstance.py index d232712a..262ebe82 100644 --- a/tests/unit/ec2/test_spotinstance.py +++ b/tests/unit/ec2/test_spotinstance.py @@ -83,6 +83,8 @@ class TestGetSpotPriceHistory(AWSMockServiceTestCase): self.assertEqual(len(response), 2) self.assertEqual(response.next_token, 'q5GwEl5bMGjKq6YmhpDLJ7hEwyWU54jJC2GQ93n61vZV4s1+fzZ674xzvUlTihrl') + self.assertEqual(response.nextToken, + 'q5GwEl5bMGjKq6YmhpDLJ7hEwyWU54jJC2GQ93n61vZV4s1+fzZ674xzvUlTihrl') self.assertEqual(response[0].instance_type, 'c3.large') self.assertEqual(response[0].availability_zone, 'us-west-2c') self.assertEqual(response[1].instance_type, 'c3.large') @@ -106,4 +108,3 @@ class TestGetSpotPriceHistory(AWSMockServiceTestCase): ignore_params_values=['AWSAccessKeyId', 'SignatureMethod', 'SignatureVersion', 'Timestamp', 'Version']) - |