This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author demian.brecht
Recipients demian.brecht
Date 2015-02-27.17:30:43
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
#14721 solved setting the Content-Length header for 0-length bodies. However, it doesn't account for cases where body is None (reported by James Rutherford here:

One method of solving this might be something like this:

if method.upper() in _METHODS_EXPECTING_BODIES and \
        'content-length' not in header_names:

(_set_content_length would have to be updated in order to allow for None)

This ensures that Content-Length will not be set for methods not expecting a body.

RFC 7230, Section 3.3.2:

   A user agent SHOULD NOT send a Content-Length header field when the
   request message does not contain a payload body and the method 
   semantics do not anticipate such a body.
Date User Action Args
2015-02-27 17:30:43demian.brechtsetrecipients: + demian.brecht
2015-02-27 17:30:43demian.brechtsetmessageid: <>
2015-02-27 17:30:43demian.brechtlinkissue23539 messages
2015-02-27 17:30:43demian.brechtcreate