Don't simply swallow all http server exceptions

This commit is contained in:
croneter 2021-10-18 13:29:32 +02:00
parent d37fbb6c1a
commit e6171127dc

View file

@ -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()