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

karl report at bugs.python.org
Tue Mar 5 12:57:57 CET 2013


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 codes for 4xx is declared at 
http://tools.ietf.org/html/draft-ietf-httpbis-p2-semantics-22#section-6.5

In HTTP, only the code is mandatory, the text is optional. But indeed you reveal a loophole, which means that someone might want to send a message for the body. That said, I still do not think it should lend in the header for reasons explained previously (serious breakage).

I will come up with something which is fixing the issue without breaking the existent. 

That said, do I open another bug for the test? The test should be fixed too. It should test 400 only. and not the full status-line.

The previous test is also an issue, testing 414. Because the prose in the spec is "URI Too Long" and not "HTTP/1.1 414 Request-URI Too Long"
http://tools.ietf.org/html/draft-ietf-httpbis-p2-semantics-22#section-6.5.12

Hmmm… I see all tests are like this. It should be fixed. Opening bug? Thought?

----------

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


More information about the Python-bugs-list mailing list