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

2015-03-22 Thread James Rutherford
James Rutherford added the comment: Updated docs look good to me, thanks! -- ___ Python tracker <http://bugs.python.org/issue23539> ___ ___ Python-bugs-list mailin

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

2015-03-19 Thread James Rutherford
James Rutherford added the comment: Updated 2.7 patch attached. -- Added file: http://bugs.python.org/file38570/issue23539-py27.patch ___ Python tracker <http://bugs.python.org/issue23

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

2015-03-19 Thread James Rutherford
James Rutherford added the comment: Python 3 patch attached. The documentation has changed structure a little so I've adapted (simplified) this from the original. Otherwise, it's pretty much the same, except with python3 fixes, and incorporated feedback. I'll upload an updat

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

2015-03-13 Thread James Rutherford
James Rutherford added the comment: Ok I'll have a go at a consolidated python3 patch tomorrow. -- ___ Python tracker <http://bugs.python.org/issue23539> ___ ___

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

2015-03-13 Thread James Rutherford
James Rutherford added the comment: Hi all, apologies for the spam, but I just wanted to confirm that no-one is waiting on anything from me... I'm happy to consolidate the final minor points & make the patch against python3 if that would simpli

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

2015-03-04 Thread James Rutherford
James Rutherford added the comment: Single patch against default makes sense and I'll do that in future. As for the review comments, I'm happy to go with all of your suggestions but have offered a tweak to the docstring that you can take or leave at your

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

2015-03-02 Thread James Rutherford
James Rutherford added the comment: OK, sounds like we're approaching consensus? And I believe that the patch as-is captures that consensus, so should I proceed and make another for 3.X for review? -- ___ Python tracker <http://bugs.py

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

2015-03-01 Thread James Rutherford
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

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

2015-02-28 Thread James Rutherford
James Rutherford added the comment: I actually consider this a fix for the fix in 14721, rather than a new feature. The only new behaviour here is setting content length to be zero if body is None on PATCH, POST, or PUT. Happy to change the labeling if that's the consensus but IMO i

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

2015-02-28 Thread James Rutherford
James Rutherford added the comment: Happy to remove OPTIONS from the list of methods that gets a content-length where body is None, but do we also want to consider behaviour if it's the empty string? My feeling is that '' implies "present but empty" (so should have

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

2015-02-27 Thread James Rutherford
James Rutherford added the comment: The first patch should actually be modified so the condition reads (update attached): if body is None and method_expects_body: thelen = 0 elif body is not None: ... Demian, I believe this is equivalent to your 'expectin

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

2015-02-27 Thread James Rutherford
James Rutherford added the comment: Patch attached for the 2.7 branch, including updated tests. All tests pass. Let me know if this looks like a sensible approach and I'll produce something comparable for 3.X. The logic now is as it was before, except that we set a content length of zer

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

2015-02-27 Thread James Rutherford
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 requ

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

2015-02-27 Thread James Rutherford
James Rutherford added the comment: OK, thanks. -- versions: -Python 3.2, Python 3.3 ___ Python tracker <http://bugs.python.org/issue23539> ___ ___ Python-bug

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

2015-02-27 Thread James Rutherford
James Rutherford added the comment: Thanks for setting up the new issue, I'll cook up a patch. I'm assuming this affects all Python 3.X versions but I've specifically encountered it on Python 2.7. -- nosy: +jimr versions: +Python 2.7, Python 3.2, Python

[issue14721] httplib doesn't specify content-length header for POST requests without data

2015-02-25 Thread James Rutherford
James Rutherford added the comment: The fix for this still doesn't set Content-Length to zero when body is None, but I don't see any reason why this should be the case. For example, the following snippet would work for any 'empty' body: if 'content-length'