diff options
author | Victor Stinner <vstinner@redhat.com> | 2019-05-29 04:04:54 +0200 |
---|---|---|
committer | Ned Deily <nad@python.org> | 2019-05-28 22:04:54 -0400 |
commit | 3dbc43f63c7e056b80d6e28f3812125a09555456 (patch) | |
tree | 7c093149c58b66921278862494eb570c953ed716 | |
parent | 2b9d7abdbd4b41e2c624858f5bc80da59d8a681d (diff) | |
download | cpython-git-3dbc43f63c7e056b80d6e28f3812125a09555456.tar.gz |
bpo-32947: test_ssl fixes for TLS 1.3 and OpenSSL 1.1.1 (GH-11612)
Backport partially commit 529525fb5a8fd9b96ab4021311a598c77588b918:
complete the previous partial backport (commit
2a4ee8aa01d61b6a9c8e9c65c211e61bdb471826.
Co-Authored-By: Christian Heimes <christian@python.org>
-rw-r--r-- | Lib/test/test_ssl.py | 15 | ||||
-rw-r--r-- | Misc/NEWS.d/next/Tests/2019-01-18-17-46-10.bpo-32947.Hk0KnM.rst | 1 |
2 files changed, 16 insertions, 0 deletions
diff --git a/Lib/test/test_ssl.py b/Lib/test/test_ssl.py index 0aeabc10f2..2cabfe5d0b 100644 --- a/Lib/test/test_ssl.py +++ b/Lib/test/test_ssl.py @@ -2029,6 +2029,16 @@ if _have_threads: sys.stdout.write(" server: read %r (%s), sending back %r (%s)...\n" % (msg, ctype, msg.lower(), ctype)) self.write(msg.lower()) + except ConnectionResetError: + # XXX: OpenSSL 1.1.1 sometimes raises ConnectionResetError + # when connection is not shut down gracefully. + if self.server.chatty and support.verbose: + sys.stdout.write( + " Connection reset by peer: {}\n".format( + self.addr) + ) + self.close() + self.running = False except OSError: if self.server.chatty: handle_error("Test server failure:\n") @@ -2108,6 +2118,11 @@ if _have_threads: pass except KeyboardInterrupt: self.stop() + except BaseException as e: + if support.verbose and self.chatty: + sys.stdout.write( + ' connection handling failed: ' + repr(e) + '\n') + self.sock.close() def stop(self): diff --git a/Misc/NEWS.d/next/Tests/2019-01-18-17-46-10.bpo-32947.Hk0KnM.rst b/Misc/NEWS.d/next/Tests/2019-01-18-17-46-10.bpo-32947.Hk0KnM.rst new file mode 100644 index 0000000000..f508504ea6 --- /dev/null +++ b/Misc/NEWS.d/next/Tests/2019-01-18-17-46-10.bpo-32947.Hk0KnM.rst @@ -0,0 +1 @@ +test_ssl fixes for TLS 1.3 and OpenSSL 1.1.1. |