Commit dfe6c3ee authored by Matthew Johnson's avatar Matthew Johnson
Browse files

[webserver] Update the webserver for python3

parent 83786873
......@@ -110,7 +110,7 @@ def start_ping(net):
def start_webserver(net):
h1 = net.get("h1")
proc = h1.popen("python webserver.py", shell=True)
proc = h1.popen("python3 webserver.py", shell=True)
sleep(1)
return [proc]
......
import SimpleHTTPServer
import SocketServer
""" A very basic stdlib http server
PORT = 80
Serves files out of the current working directory. Credit to updating for
python3 to Chris Gunn<cwize1@cs.washington.edu>.
"""
from http.server import SimpleHTTPRequestHandler, HTTPServer
PORT = 80
class Handler(SimpleHTTPServer.SimpleHTTPRequestHandler):
class Handler(SimpleHTTPRequestHandler):
# Disable logging DNS lookups
def address_string(self):
return str(self.client_address[0])
Handler = Handler
httpd = SocketServer.TCPServer(("", PORT), Handler)
httpd = HTTPServer(("", PORT), Handler)
print("Server1: httpd serving at port", PORT)
httpd.serve_forever()
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment