[issue23539] Content-length not set for HTTP methods expecting body when body is None

James Rutherford report at bugs.python.org
Fri Feb 27 20:24:27 CET 2015


James Rutherford added the comment:

OK, I've got a patch but it's failing on 'test_send_file'[1], which is sending a body on a GET request. According to the IETF memo[2]:

   Bodies on GET requests have no defined semantics.  Note that sending
   a body on a GET request might cause some existing implementations to
   reject the request.

So I don't know whether to remove the method constraint so this test passes, or to "fix" this test to use a different method. My feeling is that stripping out Content-Length for GET requests could cause problems for some code that for whatever reason uses this, so we should remove that constraint (it was only "SHOULD NOT" after all) and go back to the original proposal of just setting the content length for bodies that are None as well as empty strings.

[1] https://hg.python.org/cpython/file/325aec842e3e/Lib/test/test_httplib.py#l297
[2] http://tools.ietf.org/html/draft-ietf-httpbis-p2-semantics-14#section-7.3

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue23539>
_______________________________________


More information about the Python-bugs-list mailing list