aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/server.py
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2022-01-25 02:36:46 +0300
committerEgor Tensin <Egor.Tensin@gmail.com>2022-01-25 02:36:46 +0300
commit8d71b8b95ee96d3727ddac9c270977c6f90732de (patch)
treee4b255483253e2247986efcbf90358947ee5d951 /server.py
parentdebian: 1.1.0-1 (diff)
parentworkflows/ci: run tests as root also (diff)
downloadlinux-status-8d71b8b95ee96d3727ddac9c270977c6f90732de.tar.gz
linux-status-8d71b8b95ee96d3727ddac9c270977c6f90732de.zip
Merge tag 'v1.2' into debian
Diffstat (limited to '')
-rwxr-xr-xserver.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/server.py b/server.py
index 1b64766..0ebe5d5 100755
--- a/server.py
+++ b/server.py
@@ -12,8 +12,9 @@ import argparse
import http.server
import os
import sys
+import traceback
-from app import Request
+from app import Request, Response
DEFAULT_PORT = 18101
@@ -31,11 +32,12 @@ class RequestHandler(http.server.SimpleHTTPRequestHandler):
return super().do_GET()
try:
response = request.process()
+ response.write_to_request_handler(self)
except:
- self.send_response(http.server.HTTPStatus.INTERNAL_SERVER_ERROR)
- self.end_headers()
+ status = http.server.HTTPStatus.INTERNAL_SERVER_ERROR
+ response = Response(traceback.format_exc(), status)
+ response.write_to_request_handler(self)
return
- response.write_as_request_handler(self)
def parse_args(args=None):