Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python - BaseHTTPServer.HTTPServer Concurrency & Threading

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

like image 871
Ian Avatar asked Mar 07 '10 21:03

Ian


1 Answers

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
like image 119
Wolph Avatar answered Nov 11 '22 04:11

Wolph