Improve documentation
This commit is contained in:
@@ -20,13 +20,15 @@ class RequestHandler:
|
||||
A RequestHandler instance processes incoming HTTP requests messages from a single client.
|
||||
|
||||
RequestHandler instances are created everytime a client connects. They will read the incoming
|
||||
messages, parse, verify them and send a respond.
|
||||
messages, parse, verify them and send a response.
|
||||
"""
|
||||
|
||||
conn: ServerSocket
|
||||
host: str
|
||||
|
||||
def __init__(self, conn: socket, host):
|
||||
self.conn = ServerSocket(conn, host)
|
||||
self.conn = ServerSocket(conn)
|
||||
self.host = host
|
||||
|
||||
def listen(self):
|
||||
"""
|
||||
@@ -111,7 +113,7 @@ class RequestHandler:
|
||||
# Only http is supported...
|
||||
raise BadRequest(f"scheme={target.scheme}")
|
||||
|
||||
if target.netloc != "" and target.netloc != self.conn.host and target.netloc != self.conn.host.split(":")[0]:
|
||||
if target.netloc != "" and target.netloc != self.host and target.netloc != self.host.split(":")[0]:
|
||||
raise NotFound(str(target))
|
||||
|
||||
if target.path == "" or target.path[0] != "/":
|
||||
@@ -123,7 +125,7 @@ class RequestHandler:
|
||||
|
||||
@see: _check_request_line for exceptions raised when validating the request-line.
|
||||
@param msg: the message to validate
|
||||
@raise BadRequest: if HTTP 1.1 and the Host header is missing
|
||||
@raise BadRequest: if HTTP 1.1, and the Host header is missing
|
||||
"""
|
||||
|
||||
if msg.version == "1.1" and "host" not in msg.headers:
|
||||
|
Reference in New Issue
Block a user