From 4f53e2ac16e0bebae0a0c18f220295035b081ee3 Mon Sep 17 00:00:00 2001 From: Julien Palard Date: Wed, 30 May 2018 02:24:17 +0200 Subject: [PATCH] [3.7] bpo-31639: Change ThreadedHTTPServer to ThreadingHTTPServer class name (GH-7195) (GH-7219) * [3.7] bpo-31639: Change ThreadedHTTPServer to ThreadingHTTPServer class name (GH-7195). (cherry picked from commit 1cee216cf383eade641aed22f4ec7d4cb565ecff) * Fix whatsnew entry about ThreadedHTTPServer. (GH-7220) (cherry picked from commit a34e424bdbc62b4d83593af1c0d459d8aaac90f3) --- Doc/library/http.server.rst | 4 ++-- Doc/whatsnew/3.7.rst | 2 +- Lib/http/server.py | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Doc/library/http.server.rst b/Doc/library/http.server.rst index 16cfa1798aef37..0bd7f778cec0cf 100644 --- a/Doc/library/http.server.rst +++ b/Doc/library/http.server.rst @@ -33,7 +33,7 @@ handler. Code to create and run the server looks like this:: :attr:`server_port`. The server is accessible by the handler, typically through the handler's :attr:`server` instance variable. -.. class:: ThreadedHTTPServer(server_address, RequestHandlerClass) +.. class:: ThreadingHTTPServer(server_address, RequestHandlerClass) This class is identical to HTTPServer but uses threads to handle requests by using the :class:`~socketserver.ThreadingMixIn`. This @@ -43,7 +43,7 @@ handler. Code to create and run the server looks like this:: .. versionadded:: 3.7 -The :class:`HTTPServer` and :class:`ThreadedHTTPServer` must be given +The :class:`HTTPServer` and :class:`ThreadingHTTPServer` must be given a *RequestHandlerClass* on instantiation, of which this module provides three different variants: diff --git a/Doc/whatsnew/3.7.rst b/Doc/whatsnew/3.7.rst index 8b94cdcc9e6aca..2471989ec7b95c 100644 --- a/Doc/whatsnew/3.7.rst +++ b/Doc/whatsnew/3.7.rst @@ -929,7 +929,7 @@ With this parameter, the server serves the specified directory, by default it uses the current working directory. (Contributed by Stéphane Wirtel and Julien Palard in :issue:`28707`.) -The new :class:`ThreadedHTTPServer ` class +The new :class:`ThreadingHTTPServer ` class uses threads to handle requests using :class:`~socketserver.ThreadingMixin`. It is used when ``http.server`` is run with ``-m``. (Contributed by Julien Palard in :issue:`31639`.) diff --git a/Lib/http/server.py b/Lib/http/server.py index a2726ab8975013..ea0e295d283442 100644 --- a/Lib/http/server.py +++ b/Lib/http/server.py @@ -83,7 +83,7 @@ __version__ = "0.6" __all__ = [ - "HTTPServer", "ThreadedHTTPServer", "BaseHTTPRequestHandler", + "HTTPServer", "ThreadingHTTPServer", "BaseHTTPRequestHandler", "SimpleHTTPRequestHandler", "CGIHTTPRequestHandler", ] @@ -140,7 +140,7 @@ def server_bind(self): self.server_port = port -class ThreadedHTTPServer(socketserver.ThreadingMixIn, HTTPServer): +class ThreadingHTTPServer(socketserver.ThreadingMixIn, HTTPServer): daemon_threads = True @@ -1217,7 +1217,7 @@ def run_cgi(self): def test(HandlerClass=BaseHTTPRequestHandler, - ServerClass=ThreadedHTTPServer, + ServerClass=ThreadingHTTPServer, protocol="HTTP/1.0", port=8000, bind=""): """Test the HTTP request handler class.