Don't simply swallow all http server exceptions
This commit is contained in:
parent
d37fbb6c1a
commit
e6171127dc
1 changed files with 7 additions and 10 deletions
|
@ -82,16 +82,13 @@ class MyHandler(BaseHTTPRequestHandler):
|
||||||
|
|
||||||
def response(self, body, headers=None, code=200):
|
def response(self, body, headers=None, code=200):
|
||||||
headers = {} if headers is None else headers
|
headers = {} if headers is None else headers
|
||||||
try:
|
self.send_response(code)
|
||||||
self.send_response(code)
|
for key in headers:
|
||||||
for key in headers:
|
self.send_header(key, headers[key])
|
||||||
self.send_header(key, headers[key])
|
self.send_header('Content-Length', len(body))
|
||||||
self.send_header('Content-Length', len(body))
|
self.end_headers()
|
||||||
self.end_headers()
|
if body:
|
||||||
if body:
|
self.wfile.write(body.encode('utf-8'))
|
||||||
self.wfile.write(body.encode('utf-8'))
|
|
||||||
except Exception as exc:
|
|
||||||
LOG.debug('Exception encountered while responding: %s', exc)
|
|
||||||
|
|
||||||
def answer_request(self, send_data):
|
def answer_request(self, send_data):
|
||||||
self.serverlist = self.server.client.getServerList()
|
self.serverlist = self.server.client.getServerList()
|
||||||
|
|
Loading…
Reference in a new issue