I tried to create a HTTP-server in Python using Threading:
from socketserver import ThreadingMixIn
from http.server import HTTPServer, BaseHTTPRequestHandler
import time, threading
class ThreadingServer(ThreadingMixIn, HTTPServer):
pass
class Handler(BaseHTTPRequestHandler):
def do_GET(self):
print("do")
time.sleep(10)
message = threading.currentThread().getName()
self.wfile.write(message)
self.wfile.write('\n')
if __name__ == "__main__":
httpd = ThreadingServer( (host, port), Handler)
httpd.serve_forever()
The server works well, but if two request are same time, they are executed sequentially. So the second request not executed until the first is finished.