James Rutherford added the comment: >> My feeling is that '' implies "present but empty" (so should have a >> content-length set to zero), whereas None implies "missing" (so should only >> have a content-length header set to zero if the method is expecting a body. > ... > In light of that, I think that HTTPConnection(‘example.com’).request(‘GET’, > ‘/‘, ‘’) and HTTPConnection(‘example.com’).request(‘GET’, ‘/‘) should result > in identical headers with no Content-Length set.
I get your reasoning here, but I wonder if that goes beyond the scope of this issue? My initial thinking was the same, but then realised that was inconsistent with the current behaviour. For example, a GET with '' in the body already sets content-length: 0, but a GET with None for the body doesn't set a content length at all. I haven't changed this behaviour in my patch, except for PUT, POST, and PATCH where None and '' are now equivalent for those methods. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue23539> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com