Skip to content

Commit

Permalink
Ensure Content-Length header when PUT/POST a container
Browse files Browse the repository at this point in the history
Fixes bug #951155

Change-Id: Ib1455ddb142137cc0946d50a66540eae6402f598
  • Loading branch information
sorrison committed Aug 15, 2012
1 parent 99b8253 commit 29c3af8
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions swiftclient/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -556,6 +556,8 @@ def put_container(url, token, container, headers=None, http_conn=None):
if not headers:
headers = {}
headers['X-Auth-Token'] = token
if not 'content-length' in (k.lower() for k in headers):
headers['Content-Length'] = 0
conn.request(method, path, '', headers)
resp = conn.getresponse()
body = resp.read()
Expand Down Expand Up @@ -588,6 +590,8 @@ def post_container(url, token, container, headers, http_conn=None):
path = '%s/%s' % (parsed.path, quote(container))
method = 'POST'
headers['X-Auth-Token'] = token
if not 'content-length' in (k.lower() for k in headers):
headers['Content-Length'] = 0
conn.request(method, path, '', headers)
resp = conn.getresponse()
body = resp.read()
Expand Down

0 comments on commit 29c3af8

Please sign in to comment.