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

karl report at bugs.python.org
Wed Feb 27 01:27:02 CET 2013


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.

After modifications this is what I get.

→ telnet localhost 9000
Trying ::1...
telnet: connect to address ::1: Connection refused
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
GET / HTTP/1.1
Host: localhost:9000

HTTP/1.0 500 Internal Server Error
Server: BaseHTTP/0.6 Python/3.3.0
Date: Wed, 27 Feb 2013 00:21:21 GMT
Content-Type: text/html;charset=utf-8
Connection: close

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
        "http://www.w3.org/TR/html4/strict.dtd">
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html;charset=utf-8">
        <title>Error response</title>
    </head>
    <body>
        <h1>Error response</h1>
        <p>Error code: 500</p>
        <p>Message: Traceback (most recent call last):
  File "server.py", line 11, in do_GET
    assert(False)
AssertionError
.</p>
        <p>Error code explanation: 500 - Server got itself in trouble.</p>
    </body>
</html>
Connection closed by foreign host.


I joined the patch: server.issue12921.patch

----------
keywords: +patch
Added file: http://bugs.python.org/file29255/server.issue12921.patch

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


More information about the Python-bugs-list mailing list