[Python-checkins] closes bpo-36755: Suppress noisy error output in test HTTPS server by default. (GH-13370)

Benjamin Peterson webhook-mailer at python.org
Fri May 17 14:29:42 EDT 2019


https://github.com/python/cpython/commit/951af2d7f140be7beb9cda2bcdd54f820c905e45
commit: 951af2d7f140be7beb9cda2bcdd54f820c905e45
branch: 2.7
author: Benjamin Peterson <benjamin at python.org>
committer: GitHub <noreply at github.com>
date: 2019-05-17T11:29:38-07:00
summary:

closes bpo-36755: Suppress noisy error output in test HTTPS server by default. (GH-13370)

TLS 1.3 has a more efficient handshake protocol. The client can reject the server's credentials and close the connection before the server has even finished writing out all of its initial data. Depending on whether the server finishes writing the rest of its handshake before the it sees the connection is reset, the server will read an empty line or see a ECONNRESET OSError. Nothing is really wrong here with the server or client, so just suppress the error output in the OSError case to fix the test.

This fix isn't required in Python 3 because clients that reject the server's certificate will shut down the TLS layer before closing the TCP connection.

files:
M Lib/test/ssl_servers.py

diff --git a/Lib/test/ssl_servers.py b/Lib/test/ssl_servers.py
index a312e28573ea..a5023052d3b6 100644
--- a/Lib/test/ssl_servers.py
+++ b/Lib/test/ssl_servers.py
@@ -42,6 +42,11 @@ def get_request(self):
             raise
         return sslconn, addr
 
+    def handle_error(self, request, client_address):
+        "Suppose noisy error output by default."
+        if support.verbose:
+            _HTTPServer.handle_error(self, request, client_address)
+
 class RootedHTTPRequestHandler(SimpleHTTPRequestHandler):
     # need to override translate_path to get a known root,
     # instead of using os.curdir, since the test could be



More information about the Python-checkins mailing list