Fix Issue14721: Send Content-length: 0 for empty body () in the http.request

This commit is contained in:
Senthil Kumaran 2012-05-19 16:52:21 +08:00
parent ea24dda01f
commit 618802d55e
3 changed files with 32 additions and 1 deletions

View file

@ -989,7 +989,7 @@ class HTTPConnection:
self.putrequest(method, url, **skips)
if body and ('content-length' not in header_names):
if body is not None and 'content-length' not in header_names:
self._set_content_length(body)
for hdr, value in headers.iteritems():
self.putheader(hdr, value)