Permalink
Browse files

updated httpd.py, python 2.7 code only, and compatible with IE on win…

…dows
  • Loading branch information...
1 parent 130d9cd commit 79cd2e6c96f797e6a80746d63036b19e2dc3d82f @Pomax Pomax committed Jul 16, 2011
Showing with 13 additions and 14 deletions.
  1. +13 −14 tools/httpd.py
View
@@ -1,22 +1,21 @@
#!/usr/bin/env python
-
+
PORT = 9914
+SERVER = '0.0.0.0'
+
+import SimpleHTTPServer
+import BaseHTTPServer
+import SocketServer
-try:
- try:
- import SimpleHTTPServer
- import SocketServer
+Handler = SimpleHTTPServer.SimpleHTTPRequestHandler
- Handler = SimpleHTTPServer.SimpleHTTPRequestHandler
- httpd = SocketServer.TCPServer(("localhost", PORT), Handler)
- print "Web Server listening on http://localhost:%s/ (stop with ctrl+c)..." % PORT
- httpd.serve_forever()
+class Server(SocketServer.ThreadingMixIn, BaseHTTPServer.HTTPServer):
+ pass
- except ImportError:
- from http.server import HTTPServer, SimpleHTTPRequestHandler
+httpd = Server((SERVER, PORT), Handler)
+print "Web Server listening on http://%s:%s/ (stop with ctrl+c)..." % (SERVER, PORT)
- httpd = HTTPServer(('localhost', 9914), SimpleHTTPRequestHandler)
- print "Web Server listening on http://localhost:%s/ (stop with ctrl+c)..." % PORT
+try:
httpd.serve_forever()
except KeyboardInterrupt:
- pass
+ print "Going down..."

0 comments on commit 79cd2e6

Please sign in to comment.