summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Beach <coder@beachfamily.net>2011-06-27 14:10:43 -0400
committerBrian Beach <coder@beachfamily.net>2011-06-27 14:10:43 -0400
commit25dfa60fe8e355423cfd860f319539c1f5d6b7dd (patch)
tree41363aad96f668d04c1bd445cb8a741246368add
parentb75d181484cf0a5256a9c5efd3373398c2c8a30e (diff)
downloadboto-25dfa60fe8e355423cfd860f319539c1f5d6b7dd.tar.gz
Fix content-length when retrying http call.
Always set the content-length, even if there already was one. Re-signing a request can result in the signature being a different length (because of URL encoding), and thus the whole body being a different length.
-rw-r--r--boto/connection.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/boto/connection.py b/boto/connection.py
index 73c221b8..9337b63a 100644
--- a/boto/connection.py
+++ b/boto/connection.py
@@ -159,8 +159,12 @@ class HTTPRequest(object):
connection._auth_handler.add_auth(self, **kwargs)
self.headers['User-Agent'] = UserAgent
- if not self.headers.has_key('Content-Length'):
- self.headers['Content-Length'] = str(len(self.body))
+
+ # Always set the content-length, even if there already was
+ # one. Re-signing a request can result in the signature being
+ # a different length (because of URL encoding), and thus the
+ # whole body being a different length.
+ self.headers['Content-Length'] = str(len(self.body))
class AWSAuthConnection(object):
def __init__(self, host, aws_access_key_id=None, aws_secret_access_key=None,