bpo-31870: Add a timeout parameter to ssl.get_server_certificate() (GH-22270)

This commit is contained in:
Zackery Spytz 2021-04-23 22:46:01 -06:00 committed by GitHub
parent 6c681e1a4a
commit b2fac1afaa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 27 additions and 6 deletions

View file

@ -2136,6 +2136,11 @@ class SimpleBackgroundTests(unittest.TestCase):
# independent test method
_test_get_server_certificate_fail(self, *self.server_addr)
def test_get_server_certificate_timeout(self):
with self.assertRaises(socket.timeout):
ssl.get_server_certificate(self.server_addr, ca_certs=SIGNING_CA,
timeout=0.0001)
def test_ciphers(self):
with test_wrap_socket(socket.socket(socket.AF_INET),
cert_reqs=ssl.CERT_NONE, ciphers="ALL") as s: