Skip to content

Commit 4b85253

Browse files
committed
Update
1 parent 6e51ec3 commit 4b85253

File tree

2 files changed

+19
-18
lines changed

2 files changed

+19
-18
lines changed

Doc/library/http.server.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ handler. Code to create and run the server looks like this::
5757
5858
Subclass of :class:`HTTPServer` with a wrapped socket using the :mod:`ssl` module.
5959
If the :mod:`ssl` module is not available, instantiating a :class:`!HTTPSServer`
60-
object fails with an :exc:`RuntimeError`.
60+
object fails with a :exc:`RuntimeError`.
6161

6262
The *certfile* argument is the path to the SSL certificate chain file,
6363
and the *keyfile* is the path to file containing the private key.

Lib/test/test_httpservers.py

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,24 @@ def read(self, n=None):
5050
return ''
5151

5252

53+
class DummyRequestHandler(NoLogRequestHandler, SimpleHTTPRequestHandler):
54+
pass
55+
56+
def create_https_server(
57+
certfile,
58+
keyfile=None,
59+
password=None,
60+
*,
61+
address=('localhost', 0),
62+
request_handler=DummyRequestHandler,
63+
64+
):
65+
return HTTPSServer(
66+
address, request_handler,
67+
certfile=certfile, keyfile=keyfile, password=password
68+
)
69+
70+
5371
class TestServerThread(threading.Thread):
5472
def __init__(self, test_object, request_handler, tls=None):
5573
threading.Thread.__init__(self)
@@ -337,23 +355,6 @@ def test_head_via_send_error(self):
337355
def certdata_file(*path):
338356
return os.path.join(os.path.dirname(__file__), "certdata", *path)
339357

340-
class DummyRequestHandler(NoLogRequestHandler, SimpleHTTPRequestHandler):
341-
pass
342-
343-
def create_https_server(
344-
certfile,
345-
keyfile=None,
346-
password=None,
347-
*,
348-
address=('localhost', 0),
349-
request_handler=DummyRequestHandler,
350-
351-
):
352-
return HTTPSServer(
353-
address, request_handler,
354-
certfile=certfile, keyfile=keyfile, password=password
355-
)
356-
357358

358359
@unittest.skipIf(ssl is None, "requires ssl")
359360
class BaseHTTPSServerTestCase(BaseTestCase):

0 commit comments

Comments
 (0)