Skip to content

Commit 951af2d

Browse files
authored
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.
1 parent f24a9f3 commit 951af2d

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

Lib/test/ssl_servers.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,11 @@ def get_request(self):
4242
raise
4343
return sslconn, addr
4444

45+
def handle_error(self, request, client_address):
46+
"Suppose noisy error output by default."
47+
if support.verbose:
48+
_HTTPServer.handle_error(self, request, client_address)
49+
4550
class RootedHTTPRequestHandler(SimpleHTTPRequestHandler):
4651
# need to override translate_path to get a known root,
4752
# instead of using os.curdir, since the test could be

0 commit comments

Comments
 (0)