git-svn-id: https://s3tools.svn.sourceforge.net/svnroot/s3tools/s3cmd/trunk@369 830e0280-6d2a-0410-9c65-932aecc39d9d
Michal Ludvig authored on 2009/02/12 06:56:44... | ... |
@@ -154,7 +154,6 @@ class S3(object): |
154 | 154 |
self.check_bucket_name(bucket, dns_strict = True) |
155 | 155 |
else: |
156 | 156 |
self.check_bucket_name(bucket, dns_strict = False) |
157 |
- headers["content-length"] = len(body) |
|
158 | 157 |
if self.config.acl_public: |
159 | 158 |
headers["x-amz-acl"] = "public-read" |
160 | 159 |
request = self.create_request("BUCKET_CREATE", bucket = bucket, headers = headers) |
... | ... |
@@ -356,6 +355,8 @@ class S3(object): |
356 | 356 |
def send_request(self, request, body = None, retries = _max_retries): |
357 | 357 |
method_string, resource, headers = request |
358 | 358 |
debug("Processing request, please wait...") |
359 |
+ if body and not headers.has_key('content-length'): |
|
360 |
+ headers['content-length'] = len(body) |
|
359 | 361 |
try: |
360 | 362 |
conn = self.get_connection(resource['bucket']) |
361 | 363 |
conn.request(method_string, self.format_uri(resource), body, headers) |