bpo-33734: asyncio/ssl: a bunch of bugfixes (#7321)

* Fix AttributeError (not all SSL exceptions have 'errno' attribute)

* Increase default handshake timeout from 10 to 60 seconds
* Make sure start_tls can be cancelled correctly
* Make sure any error in SSLProtocol gets propagated (instead of just being logged)
This commit is contained in:
Yury Selivanov 2018-06-04 11:32:35 -04:00 committed by GitHub
parent a8eb58546b
commit 9602643120
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 258 additions and 72 deletions

View file

@ -77,10 +77,11 @@ def simple_server_sslcontext():
return server_context
def simple_client_sslcontext():
def simple_client_sslcontext(*, disable_verify=True):
client_context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
client_context.check_hostname = False
client_context.verify_mode = ssl.CERT_NONE
if disable_verify:
client_context.verify_mode = ssl.CERT_NONE
return client_context