had to reference the correct handler
This commit is contained in:
parent
cc5eecb234
commit
cd7706c5c2
14
speedtest
14
speedtest
@ -18,6 +18,18 @@ WEB_DIR = '/tmp/web'
|
||||
|
||||
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}")
|
||||
self.send_response(200)
|
||||
self.send_header('Content-type', 'text/html')
|
||||
self.end_headers()
|
||||
self.wfile.write(b"<html><body><h1>Automate all the things!</h1><p>1.1.0</p></body></html>")
|
||||
return
|
||||
|
||||
|
||||
class SuperSimpleHandler(http.server.SimnpleHTTPRequestHandler):
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, directory=WEB_DIR, **kwargs)
|
||||
|
||||
@ -80,7 +92,7 @@ if __name__ == "__main__":
|
||||
log.info("Creating 1 gigabyte file...")
|
||||
create_file()
|
||||
|
||||
simple_handler = SimpleHandler() # http.server.SimpleHTTPRequestHandler
|
||||
simple_handler = SuperSimpleHandler() # http.server.SimpleHTTPRequestHandler
|
||||
|
||||
with socketserver.TCPServer((args.ip_address, args.port), SockHandler) as tcpd:
|
||||
log.info(f"Server started on {args.ip_address}:{args.port}")
|
||||
|
Loading…
Reference in New Issue
Block a user