summaryrefslogtreecommitdiff
path: root/boto/auth.py
diff options
context:
space:
mode:
authorkdmukai <keith.mukai@essaytagger.com>2013-12-22 13:05:41 -0600
committerkdmukai <keith.mukai@essaytagger.com>2013-12-22 13:05:41 -0600
commitb7a8b1900c3d7fe00085dacd4203f185d8b09bf4 (patch)
tree0f33646862c47308243a4ebfa580b1f9a1a886c4 /boto/auth.py
parentf4c11f519dc6a0543fff7860a6059b67e34f015b (diff)
downloadboto-b7a8b1900c3d7fe00085dacd4203f185d8b09bf4.tar.gz
Remove unnecessary '?' from req.path on POST
The if/else logic in add_auth on line 491 only handles if qs and POST. But if you're POSTing with no query string, execution falls into the else condition on line 497 and an unnecessary '?' is added with a blank query string. My elastictranscoder.create_job calls were failing due to the unnecessary '?' in the path. It would return: JSONResponseError: 403 Forbidden {u'message': u"When Content-Type:application/x-www-form-urlencoded, URL cannot include query-string parameters (after '?'): '/2012-09-25/jobs?'"} I'm not sure why, but the bug only happens when running on Google App Engine. My local dev_appserver was able to make the create_job request just fine.
Diffstat (limited to 'boto/auth.py')
-rw-r--r--boto/auth.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/boto/auth.py b/boto/auth.py
index 2192bc47..c8c73a22 100644
--- a/boto/auth.py
+++ b/boto/auth.py
@@ -498,7 +498,10 @@ class HmacAuthV4Handler(AuthHandler, HmacKeys):
# Safe to modify req.path here since
# the signature will use req.auth_path.
req.path = req.path.split('?')[0]
- req.path = req.path + '?' + qs
+
+ if qs:
+ # Don't insert the '?' unless there's actually a query string
+ req.path = req.path + '?' + qs
canonical_request = self.canonical_request(req)
boto.log.debug('CanonicalRequest:\n%s' % canonical_request)
string_to_sign = self.string_to_sign(req, canonical_request)