SimpleHTTPServer + Multithreading
Adonis
deltapigz at telocity.com
Thu Jun 27 12:40:56 EDT 2002
i was googling around and was able to come up with cannibalized code, and
was wondering if there was anyway to make it more "clean" looking, or as it
is, is the best way:
(main idea: a multithreading SimpleHTTPServer)
import BaseHTTPServer, SimpleHTTPServer, SocketServer, socket, webbrowser
class XFSPWebServer(SocketServer.ThreadingMixIn, BaseHTTPServer.HTTPServer):
pass
class ReqHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
def do_POST(self):
data = self.rfile.read(int(self.headers["content-length"]))
data = data.split('&')[0].split('=')[1]
self.wfile.write("HIH")
PORT = 80
httpd = XFSPWebServer((socket.gethostname(), PORT), ReqHandler)
httpd.serve_forever()
any help would greatly be appreciated.
Adonis
More information about the Python-list
mailing list