Skip to content

Commit 3dbc43f

Browse files
vstinnertiran
authored andcommitted
bpo-32947: test_ssl fixes for TLS 1.3 and OpenSSL 1.1.1 (GH-11612)
Backport partially commit 529525f: complete the previous partial backport (commit 2a4ee8a. Co-Authored-By: Christian Heimes <christian@python.org>
1 parent 2b9d7ab commit 3dbc43f

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

Lib/test/test_ssl.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2029,6 +2029,16 @@ def run(self):
20292029
sys.stdout.write(" server: read %r (%s), sending back %r (%s)...\n"
20302030
% (msg, ctype, msg.lower(), ctype))
20312031
self.write(msg.lower())
2032+
except ConnectionResetError:
2033+
# XXX: OpenSSL 1.1.1 sometimes raises ConnectionResetError
2034+
# when connection is not shut down gracefully.
2035+
if self.server.chatty and support.verbose:
2036+
sys.stdout.write(
2037+
" Connection reset by peer: {}\n".format(
2038+
self.addr)
2039+
)
2040+
self.close()
2041+
self.running = False
20322042
except OSError:
20332043
if self.server.chatty:
20342044
handle_error("Test server failure:\n")
@@ -2108,6 +2118,11 @@ def run(self):
21082118
pass
21092119
except KeyboardInterrupt:
21102120
self.stop()
2121+
except BaseException as e:
2122+
if support.verbose and self.chatty:
2123+
sys.stdout.write(
2124+
' connection handling failed: ' + repr(e) + '\n')
2125+
21112126
self.sock.close()
21122127

21132128
def stop(self):
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
test_ssl fixes for TLS 1.3 and OpenSSL 1.1.1.

0 commit comments

Comments
 (0)