Python - BaseHTTPServer.HTTPServer Concurrency & Threading

Ian picture Ian · Mar 7, 2010 · Viewed 12.3k times · Source

Is there a way to make BaseHTTPServer.HTTPServer be multi-threaded like SocketServer.ThreadingTCPServer?

Answer

Wolph picture Wolph · Mar 7, 2010

You can simply use the threading mixin using both of those classes to make it multithread :)

It won't help you much in performance though, but it's atleast multithreaded.

from SocketServer import ThreadingMixIn
from BaseHTTPServer import HTTPServer

class MultiThreadedHTTPServer(ThreadingMixIn, HTTPServer):
    pass