diff --git a/SimpleHTTPPutServer b/SimpleHTTPPutServer index 77adb3a..a8175f9 100644 --- a/SimpleHTTPPutServer +++ b/SimpleHTTPPutServer @@ -1,17 +1,15 @@ -# Use this command to start the server on port 80: sudo python SimpleHTTPPutServer 80 - -import SimpleHTTPServer -import BaseHTTPServer - -class SputHTTPRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler): - def do_PUT(self): - print self.headers - length = int(self.headers["Content-Length"]) - path = self.translate_path(self.path) - with open(path, "wb") as dst: - dst.write(self.rfile.read(length)) - - -if __name__ == '__main__': - SimpleHTTPServer.test(HandlerClass=SputHTTPRequestHandler) - +# Use this command to start the server on port 80: sudo python SimpleHTTPPutServer 80 + +import http.server + +class SputHTTPRequestHandler(http.server.SimpleHTTPRequestHandler): + def do_PUT(self): + print (self.headers) + length = int(self.headers["Content-Length"]) + path = self.translate_path(self.path) + with open(path, "wb") as dst: + dst.write(self.rfile.read(length)) + + +if __name__ == '__main__': + http.server.test(HandlerClass=SputHTTPRequestHandler) \ No newline at end of file