mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
bpo-31639: Use threads in http.server module. (GH-5018)
This commit is contained in:
parent
a0a42d22d8
commit
8bcfa02e4b
3 changed files with 18 additions and 4 deletions
|
@ -83,7 +83,7 @@ XXX To do:
|
|||
__version__ = "0.6"
|
||||
|
||||
__all__ = [
|
||||
"HTTPServer", "BaseHTTPRequestHandler",
|
||||
"HTTPServer", "ThreadedHTTPServer", "BaseHTTPRequestHandler",
|
||||
"SimpleHTTPRequestHandler", "CGIHTTPRequestHandler",
|
||||
]
|
||||
|
||||
|
@ -140,6 +140,10 @@ class HTTPServer(socketserver.TCPServer):
|
|||
self.server_port = port
|
||||
|
||||
|
||||
class ThreadedHTTPServer(socketserver.ThreadingMixIn, HTTPServer):
|
||||
daemon_threads = True
|
||||
|
||||
|
||||
class BaseHTTPRequestHandler(socketserver.StreamRequestHandler):
|
||||
|
||||
"""HTTP request handler base class.
|
||||
|
@ -1213,7 +1217,8 @@ class CGIHTTPRequestHandler(SimpleHTTPRequestHandler):
|
|||
|
||||
|
||||
def test(HandlerClass=BaseHTTPRequestHandler,
|
||||
ServerClass=HTTPServer, protocol="HTTP/1.0", port=8000, bind=""):
|
||||
ServerClass=ThreadedHTTPServer,
|
||||
protocol="HTTP/1.0", port=8000, bind=""):
|
||||
"""Test the HTTP request handler class.
|
||||
|
||||
This runs an HTTP server on port 8000 (or the port argument).
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue