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

2015-02-27 Thread Demian Brecht
Demian Brecht added the comment: Thanks for the heads up Ned. James: I've created #23539 in the event that you'd like to contribute a patch. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14721

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

2015-02-27 Thread Ned Deily
Ned Deily added the comment: James, Demian: this issue has been closed for almost three years and the changes released long ago: comments made here will likely be ignored. Please open a new issue if you want them to be acted on. -- nosy: +ned.deily versions: -Python 3.5

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

2015-02-26 Thread Demian Brecht
Demian Brecht added the comment: I'm happy to produce a patch if there's any chance it would be merged. If the patch adheres to the RFC, then I see no reason why it shouldn't be merged. What makes this a little more tricky than the snippet that you included in your post though (which would

[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' not in header_names:

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

2012-05-19 Thread Senthil Kumaran
Senthil Kumaran sent...@uthcode.com added the comment: The rule for content-length seems, if there is a body for a request, even if the body is ( empty body), then you should send the Content-Length. The mistake in the Python httplib was, the set_content_length was called with this

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

2012-05-19 Thread Roundup Robot
Roundup Robot devn...@psf.upfronthosting.co.za added the comment: New changeset 57f1d13c2cd4 by Senthil Kumaran in branch '2.7': Fix Issue14721: Send Content-length: 0 for empty body () in the http.request http://hg.python.org/cpython/rev/57f1d13c2cd4 New changeset 6da1ab5f777d by Senthil

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

2012-05-19 Thread Senthil Kumaran
Senthil Kumaran sent...@uthcode.com added the comment: This is fixed in all the branches. Thanks! -- assignee: - orsenthil resolution: - fixed stage: needs patch - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org

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

2012-05-19 Thread Jesús Cea Avión
Jesús Cea Avión j...@jcea.es added the comment: Too late for asking to keep the parenthesis :-). I hate to have to remember non-obvious precedence rules :-). Cognitive overhead. -- ___ Python tracker rep...@bugs.python.org

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

2012-05-04 Thread Arve Knudsen
New submission from Arve Knudsen arve.knud...@gmail.com: httplib doesn't specify the HTTP header 'content-length' for POST requests without data. Conceptually this makes sense, considering the empty content. However, IIS (7.5) servers don't accept such requests and respond with a 411 status

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

2012-05-04 Thread Jesús Cea Avión
Jesús Cea Avión j...@jcea.es added the comment: Could you provide a patch? Does this affect 3.x too? -- nosy: +jcea ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14721 ___

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

2012-05-04 Thread Ezio Melotti
Changes by Ezio Melotti ezio.melo...@gmail.com: -- nosy: +ezio.melotti stage: - test needed type: - behavior ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14721 ___

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

2012-05-04 Thread Arve Knudsen
Arve Knudsen arve.knud...@gmail.com added the comment: I can look into patch and 3.x tonight I think. Should I provide a test with an eventual patch? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14721

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

2012-05-04 Thread Jesús Cea Avión
Jesús Cea Avión j...@jcea.es added the comment: Patch with test, please :-). I know it is a pain in the ass, but the result is having a higher quality python. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14721

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

2012-05-04 Thread Antoine Pitrou
Changes by Antoine Pitrou pit...@free.fr: -- nosy: +orsenthil stage: test needed - needs patch versions: +Python 3.2, Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14721 ___

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

2012-05-04 Thread Piotr Dobrogost
Piotr Dobrogost p...@bugs.python.dobrogost.net added the comment: Fiddler reports that it receives the following headers for the POST request Python 3.2.3 on Windows Vista 64bit gives the same output for import http.client conn = http.client.HTTPConnection('localhost',) conn.request(POST,

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

2012-05-04 Thread Éric Araujo
Changes by Éric Araujo mer...@netwok.org: -- nosy: +eric.araujo ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14721 ___ ___ Python-bugs-list

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

2012-05-04 Thread Arve Knudsen
Arve Knudsen arve.knud...@gmail.com added the comment: Which HTTP methods should we auto-define content-length for? POST and PUT? I noticed that my first attempt at a patch would define content-length also for GET requests, which broke a unit test (test_ipv6host_header). --

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

2012-05-04 Thread Arve Knudsen
Arve Knudsen arve.knud...@gmail.com added the comment: Actually, when inspecting the HTTP requests sent by Chrome for the different methods (a great little Chrome app called Postman let me fire requests manually), I found that content-length would be set for most methods. I could confirm that

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

2012-05-04 Thread Jesús Cea Avión
Jesús Cea Avión j...@jcea.es added the comment: HEAD?. It doesn't make sense in HEAD if it doesn't make sense in GET. Looking around, I found this, to mud the water a little bit more: http://fixunix.com/tcp-ip/66198-http-rfc-related-question-content-length-0-get-request.html. Not being

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

2012-05-04 Thread Arve Knudsen
Arve Knudsen arve.knud...@gmail.com added the comment: Here's my initial proposal for a patch against httplib, based on the 2.7 branch of cpython repository. I've included a couple of tests, which check that when content is empty, content-length is set to 0 for certain methods (POST/PUT etc)

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

2012-05-04 Thread Arve Knudsen
Arve Knudsen arve.knud...@gmail.com added the comment: Yes, I agree it doesn't make much sense for HEAD AFAICT, but Chrome does it. Maybe there's a reason? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14721