From 5269d8277a0c2d6b78749dc86f3f903397ae5f71 Mon Sep 17 00:00:00 2001 From: Daniel Lindsley Date: Fri, 10 May 2013 15:09:58 -0700 Subject: Fixed a bug where URIs were properly canonicalized in Sig V4 signatures. --- boto/auth.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'boto/auth.py') diff --git a/boto/auth.py b/boto/auth.py index c5ff8fe8..43177ba3 100644 --- a/boto/auth.py +++ b/boto/auth.py @@ -32,13 +32,14 @@ import boto.auth_handler import boto.exception import boto.plugin import boto.utils +import copy +import datetime +from email.utils import formatdate import hmac +import os import sys -import urllib import time -import datetime -import copy -from email.utils import formatdate +import urllib from boto.auth_handler import AuthHandler from boto.exception import BotoClientError @@ -375,7 +376,11 @@ class HmacAuthV4Handler(AuthHandler, HmacKeys): return ';'.join(l) def canonical_uri(self, http_request): - return http_request.auth_path + # Normalize the path. + normalized = os.path.normpath(http_request.auth_path) + # Then urlencode whatever's left. + encoded = urllib.quote(normalized) + return encoded def payload(self, http_request): body = http_request.body -- cgit v1.2.1