Skip to content
Browse files

use httpserver threading mixin

  • Loading branch information...
1 parent 70e2332 commit 2323e1a1125c3380c09de21afd89c0f84c1fdd5d Scott Smith committed Aug 30, 2011
Showing with 8 additions and 4 deletions.
  1. +3 −3 porkchop/commandline.py
  2. +5 −1 porkchop/server.py
View
6 porkchop/commandline.py
@@ -1,8 +1,8 @@
-from BaseHTTPServer import HTTPServer
from optparse import OptionParser
from server import GetHandler
from porkchop.plugin import PorkchopPluginHandler
+from porkchop.server import GetHandler, ThreadedHTTPServer
def main():
plugin_dir = '/usr/share/porkchop/plugins'
@@ -25,6 +25,6 @@ def main():
(options, args) = parser.parse_args()
PorkchopPluginHandler(options.plugindir)
- server = HTTPServer((options.listen_address, options.listen_port),
- GetHandler)
+ server = ThreadedHTTPServer((options.listen_address, options.listen_port),
+ GetHandler)
server.serve_forever()
View
6 porkchop/server.py
@@ -1,5 +1,6 @@
-from BaseHTTPServer import BaseHTTPRequestHandler
+from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
import json
+from SocketServer import ThreadingMixIn
import urlparse
from porkchop.plugin import PorkchopPluginHandler
@@ -59,3 +60,6 @@ def do_GET(self):
self.wfile.write(self.format_body(fmt, {}))
return
+
+class ThreadedHTTPServer(ThreadingMixIn, HTTPServer):
+ """ do stuff """

0 comments on commit 2323e1a

Please sign in to comment.
Something went wrong with that request. Please try again.