Skip to content
This repository has been archived by the owner on May 10, 2024. It is now read-only.

Commit

Permalink
Merge branch 'hotfix-2.22.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
toastdriven committed Jan 6, 2014
2 parents 06a3dae + 5415231 commit 487ea4e
Show file tree
Hide file tree
Showing 8 changed files with 54 additions and 5 deletions.
4 changes: 2 additions & 2 deletions README.rst
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion boto/__init__.py
Expand Up @@ -37,7 +37,7 @@
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
Expand Down
5 changes: 4 additions & 1 deletion boto/auth.py
Expand Up @@ -534,7 +534,10 @@ def canonical_uri(self, http_request):
# 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):
Expand Down
3 changes: 3 additions & 0 deletions boto/resultset.py
Expand Up @@ -119,6 +119,9 @@ def endElement(self, name, value, connection):
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)
Expand Down
1 change: 1 addition & 0 deletions docs/source/index.rst
Expand Up @@ -116,6 +116,7 @@ Release Notes
.. toctree::
:titlesonly:

releasenotes/v2.22.1
releasenotes/v2.22.0
releasenotes/v2.21.2
releasenotes/v2.21.1
Expand Down
22 changes: 22 additions & 0 deletions 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`)
19 changes: 19 additions & 0 deletions tests/unit/auth/test_sigv4.py
Expand Up @@ -346,6 +346,25 @@ def test_canonical_query_string(self):
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',
Expand Down
3 changes: 2 additions & 1 deletion tests/unit/ec2/test_spotinstance.py
Expand Up @@ -83,6 +83,8 @@ def test_get_spot_price_history(self):
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')
Expand All @@ -106,4 +108,3 @@ def test_get_spot_price_history(self):
ignore_params_values=['AWSAccessKeyId', 'SignatureMethod',
'SignatureVersion', 'Timestamp',
'Version'])

0 comments on commit 487ea4e

Please sign in to comment.