[issue12921] http.server.BaseHTTPRequestHandler.send_error and trailing newline

2013-03-13 Thread Senthil Kumaran
Senthil Kumaran added the comment: Karl - I reviewed the patch and like it. Here are some comments. At first, I did not see the need for both "message" and "explain" in the API both having almost similar purposes. But given that "explain" is already used by send_error and at the moment, un-cus

[issue12921] http.server.BaseHTTPRequestHandler.send_error and trailing newline

2013-03-05 Thread karl
karl added the comment: R.david Trying another patch just for understanding if it's what you meant. What it does: 1. adding an 'explain' keyword 2. escaping the explain message for the body 3. checking for injection of newline in the reason phrase. For the part 3, TODO: check if there are oth

[issue12921] http.server.BaseHTTPRequestHandler.send_error and trailing newline

2013-03-05 Thread R. David Murray
R. David Murray added the comment: Your suggestion could probably be applied as a bug fix to maintenance releases, but is it worth the effort? We don't generally try to protect programmers from themselves in Python. On the other hand, there should clearly be a way to provide the 'explain' tex

[issue12921] http.server.BaseHTTPRequestHandler.send_error and trailing newline

2013-03-05 Thread karl
karl added the comment: hehe. No hard feelings. I still do not think it is a good idea to test the "error code" and its associated message in the same test. :) For example, in RFC2616, 414 is defined as 414 Request-URI Too Long and in the HTTP1.1bis (which will not get a new version numb

[issue12921] http.server.BaseHTTPRequestHandler.send_error and trailing newline

2013-03-05 Thread R. David Murray
R. David Murray added the comment: Which I closed, sorry. I agree it should be possible to control the text produced with the error code separately from the text in the body. I prefer the specific text produced by our http server to the generic message, but I would only be -0 on changing this

[issue12921] http.server.BaseHTTPRequestHandler.send_error and trailing newline

2013-03-05 Thread karl
karl added the comment: Senthil, I created another bug reports for the tests which are fragile. http://bugs.python.org/issue17355 -- ___ Python tracker ___

[issue12921] http.server.BaseHTTPRequestHandler.send_error and trailing newline

2013-03-05 Thread karl
karl added the comment: The culprit is here http://hg.python.org/cpython/file/3.3/Lib/http/server.py#l320 That an application or a person decides to send another message is ok. Designer choice. That the library is sending something optional as a test seems more uncomfortable. The list of cod

[issue12921] http.server.BaseHTTPRequestHandler.send_error and trailing newline

2013-03-05 Thread Roundup Robot
Roundup Robot added the comment: New changeset 4e6c46d5f77d by Senthil Kumaran in branch '2.7': Reverting the changeset c31d700dea8b made for Issue #12921 http://hg.python.org/cpython/rev/4e6c46d5f77d New changeset 637d7c953b10 by Senthil Kumaran in branch '3.2': Reverting the changeset 5126e62c

[issue12921] http.server.BaseHTTPRequestHandler.send_error and trailing newline

2013-03-05 Thread Senthil Kumaran
Senthil Kumaran added the comment: There is a test failure. which leads me to believe that "Error message" may probably be relied upon by some applications. FAIL: test_header_length (test.test_httpservers.BaseHTTPRequestHandlerTestCase)

[issue12921] http.server.BaseHTTPRequestHandler.send_error and trailing newline

2013-03-05 Thread Senthil Kumaran
Senthil Kumaran added the comment: Karl - thanks for your telnet debugging session output. Helped realized the problem better. So I had been thinking that sending message is okay. But had not realized that same variable name was used and was causing problem. I have gone ahead with the fix for

[issue12921] http.server.BaseHTTPRequestHandler.send_error and trailing newline

2013-03-05 Thread Roundup Robot
Roundup Robot added the comment: New changeset c31d700dea8b by Senthil Kumaran in branch '2.7': Fix Issue #12921: BaseHTTPServer's send_error should send the correct error http://hg.python.org/cpython/rev/c31d700dea8b New changeset 5126e62c60af by Senthil Kumaran in branch '3.2': Fix Issue #1292

[issue12921] http.server.BaseHTTPRequestHandler.send_error and trailing newline

2013-03-04 Thread karl
karl added the comment: orsenthil, When you have done a patch for testing I would love to see it. I could not find a proper way of doing it. I'm eager to learn. Thanks. -- ___ Python tracker

[issue12921] http.server.BaseHTTPRequestHandler.send_error and trailing newline

2013-03-04 Thread Senthil Kumaran
Senthil Kumaran added the comment: Karl, Ack. The patch looks good. I shall go about with testing + committing this.. -- ___ Python tracker ___ __

[issue12921] http.server.BaseHTTPRequestHandler.send_error and trailing newline

2013-03-04 Thread karl
karl added the comment: orsenthil, I made a proper patch for it with hg diff. It is very short. See issue-12921-2.patch -- Added file: http://bugs.python.org/file29306/issue-12921-2.patch ___ Python tracker __

[issue12921] http.server.BaseHTTPRequestHandler.send_error and trailing newline

2013-02-26 Thread karl
karl added the comment: ok I modify the code of server.py so that the server doesn't send the private message but the one which is already assigned by the library as it should. If there is a need for customization, there should be two separate variables, but which could lead to the same issues

[issue12921] http.server.BaseHTTPRequestHandler.send_error and trailing newline

2013-02-26 Thread karl
karl added the comment: OK I had understand a bit better. self.send_error(code, msg) is used for * The body * The HTTP header * and the log That's bad, very bad. I do not think it should be used for the HTTP Header at all. -- ___ Python tracker

[issue12921] http.server.BaseHTTPRequestHandler.send_error and trailing newline

2013-02-26 Thread karl
karl added the comment: Testing your code in Listing 1 → curl -sI http://localhost:9000/ HTTP/1.0 501 Unsupported method ('HEAD') Server: BaseHTTP/0.6 Python/3.3.0 Date: Tue, 26 Feb 2013 23:38:32 GMT Content-Type: text/html;charset=utf-8 Connection: close So this is normal, http://tools.ietf.o

[issue12921] http.server.BaseHTTPRequestHandler.send_error and trailing newline

2011-09-06 Thread Senthil Kumaran
Changes by Senthil Kumaran : -- assignee: -> orsenthil nosy: +orsenthil ___ Python tracker ___ ___ Python-bugs-list mailing list Unsu

[issue12921] http.server.BaseHTTPRequestHandler.send_error and trailing newline

2011-09-06 Thread Paul Upchurch
New submission from Paul Upchurch : Calling http.server.BaseHTTPRequestHandler.send_error(code,message) with a message that contains a trailing newline does not display properly in Firefox, Chrome. Listing 1 #!/usr/bin/env python3.2 import http.server import traceback class httphandler(http