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

This commit is contained in:
Senthil Kumaran 2012-05-19 16:58:09 +08:00
parent 1be320ebdd
commit 5fa4a89601
3 changed files with 32 additions and 1 deletions

View file

@ -997,7 +997,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.items():
self.putheader(hdr, value)