Commit cb45445e authored by Ralf Schmitt's avatar Ralf Schmitt

pywsgi: send back an error reply if no bytes have been written

--HG--
extra : transplant_source : ZA%1B%88%3E%BB%C8%D5%15S%BC%BC%5B%25%F0%D2%1C/%F3m
parent 50ecd324
......@@ -272,9 +272,15 @@ class HttpProtocol(BaseHTTPServer.BaseHTTPRequestHandler):
self.close_connection = 1
exc = traceback.format_exc()
print exc
if not headers_set:
start_response("500 Internal Server Error", [('Content-type', 'text/plain')])
write(exc)
if not length[0]:
self.wfile.writelines(
["HTTP/1.0 500 Internal Server Error\r\n",
"Connection: close\r\n",
"Content-type: text/plain\r\n",
"Content-length: %s\r\n" % len(exc),
"\r\n",
exc])
finally:
if hasattr(result, 'close'):
result.close()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment