summaryrefslogtreecommitdiff
path: root/Lib/asyncio/sslproto.py
diff options
context:
space:
mode:
authorAndrew Svetlov <andrew.svetlov@gmail.com>2017-11-18 18:54:05 +0200
committerGitHub <noreply@github.com>2017-11-18 18:54:05 +0200
commit51d546ae4d563fde608e23c9c337fefd7e95c93f (patch)
treed2bd875c8f22d60a2fc5a5c522bf17a424b97757 /Lib/asyncio/sslproto.py
parentf02f5e5c3eb815fff9578dc58de60374c6baaa3d (diff)
downloadcpython-git-51d546ae4d563fde608e23c9c337fefd7e95c93f.tar.gz
bpo-32069: Drop legacy SSL transport (#4451)
* Drop legacy SSL transport * Drop unused import * Fix Windows tests * Drop never executed on Python 3.4+ code
Diffstat (limited to 'Lib/asyncio/sslproto.py')
-rw-r--r--Lib/asyncio/sslproto.py20
1 files changed, 4 insertions, 16 deletions
diff --git a/Lib/asyncio/sslproto.py b/Lib/asyncio/sslproto.py
index 53e6d2b667..c231eb58ee 100644
--- a/Lib/asyncio/sslproto.py
+++ b/Lib/asyncio/sslproto.py
@@ -18,25 +18,13 @@ def _create_transport_context(server_side, server_hostname):
# Client side may pass ssl=True to use a default
# context; in that case the sslcontext passed is None.
# The default is secure for client connections.
- if hasattr(ssl, 'create_default_context'):
- # Python 3.4+: use up-to-date strong settings.
- sslcontext = ssl.create_default_context()
- if not server_hostname:
- sslcontext.check_hostname = False
- else:
- # Fallback for Python 3.3.
- sslcontext = ssl.SSLContext(ssl.PROTOCOL_SSLv23)
- sslcontext.options |= ssl.OP_NO_SSLv2
- sslcontext.options |= ssl.OP_NO_SSLv3
- sslcontext.set_default_verify_paths()
- sslcontext.verify_mode = ssl.CERT_REQUIRED
+ # Python 3.4+: use up-to-date strong settings.
+ sslcontext = ssl.create_default_context()
+ if not server_hostname:
+ sslcontext.check_hostname = False
return sslcontext
-def _is_sslproto_available():
- return hasattr(ssl, "MemoryBIO")
-
-
# States of an _SSLPipe.
_UNWRAPPED = "UNWRAPPED"
_DO_HANDSHAKE = "DO_HANDSHAKE"