added some more request logging data and modified for variable path values
This commit is contained in:
parent
e7019853cd
commit
6ad3c2c2de
@ -17,10 +17,20 @@ class SimpleHandler(http.server.BaseHTTPRequestHandler):
|
||||
def do_GET(self):
|
||||
log.info(f"server version: {self.server_version}")
|
||||
log.info(f"client address: {self.client_address}")
|
||||
log.info(f"path: {self.path}")
|
||||
log.info(f"headers: {self.headers}")
|
||||
log.info(f"request version: {self.request_version}")
|
||||
|
||||
self.send_response(200)
|
||||
self.send_header('Content-type', 'text/html')
|
||||
self.end_headers()
|
||||
self.wfile.write(b"<html><body><h1>Hello, World!</h1><p>1.0.0</p></body></html>")
|
||||
|
||||
if self.path != '/':
|
||||
message = f"<html><body><h1>Hello, {self.path[1:]} World!</h1><p>1.0.0</p></body></html>"
|
||||
else:
|
||||
message = "<html><body><h1>Hello, World!</h1><p>1.0.0</p></body></html>"
|
||||
|
||||
self.wfile.write(bytes(message, encoding='utf-8'))
|
||||
return
|
||||
|
||||
class SockHandler(socketserver.BaseRequestHandler):
|
||||
|
Loading…
Reference in New Issue
Block a user