Bug in BaseHTTPServer.py
jgardn at alumni.washington.edu
Sun Jan 6 13:24:14 CET 2002
I'm not sure if this is a bug or not, but the "send_error" method that is
defined by default for the BaseHTTPRequestHandler doesn't seem to send
"Content-Type: text/html" and so I have problems reading the error in
Konqueror 2.2.2. Mozilla 0.9.7 pulls it up fine.
if it's a feature, let me know.
Here is my idea of what it should look like:
def send_error(self, code, message=None):
"""Send and log an error reply.
Arguments are the error code, and a detailed message.
The detailed message defaults to the short entry matching the
This sends an error response (so it must be called before any
output has been generated), logs the error, and finally sends
a piece of HTML explaining the error to the user.
short, long = self.responses[code]
short, long = '???', '???'
if not message:
message = short
explain = long
self.log_error("code %d, message %s", code, message)
That's all folks.
More information about the Python-list