Fix Issue #12921: BaseHTTPServer's send_error should send the correct error

response message when  send_error includes a message in addition to error
status. Patch contributed by Karl.
This commit is contained in:
Senthil Kumaran 2013-03-05 01:26:33 -08:00
commit 24431f1802
2 changed files with 5 additions and 1 deletions

View file

@ -426,7 +426,7 @@ class BaseHTTPRequestHandler(socketserver.StreamRequestHandler):
content = (self.error_message_format %
{'code': code, 'message': _quote_html(message), 'explain': explain})
body = content.encode('UTF-8', 'replace')
self.send_response(code, message)
self.send_response(code, shortmsg)
self.send_header("Content-Type", self.error_content_type)
self.send_header('Connection', 'close')
self.send_header('Content-Length', int(len(body)))