Improve logging, fix small issues

This commit is contained in:
2021-03-28 15:58:07 +02:00
parent cd053bc74e
commit 210c03b73f
10 changed files with 58 additions and 60 deletions

View File

@@ -66,12 +66,10 @@ class HTTPServerException(HTTPException):
"""
status_code: str
message: str
body: str
arg: str
def __init__(self, arg, body=""):
def __init__(self, arg):
self.arg = arg
self.body = body
class HTTPServerCloseException(HTTPServerException):
@@ -160,5 +158,6 @@ class InvalidRequestLine(BadRequest):
Request start-line is invalid
"""
def __init__(self, line):
def __init__(self, line, arg):
super().__init__(arg)
self.request_line = line

View File

@@ -72,7 +72,7 @@ def parse_request_line(line: str):
split = list(filter(None, line.rstrip().split(" ", 2)))
if len(split) < 3:
raise InvalidRequestLine(line)
raise InvalidRequestLine(line, "missing argument in request-line")
method, target, version = split
if method not in ("CONNECT", "DELETE", "GET", "HEAD", "OPTIONS", "POST", "PUT", "TRACE"):