diff options
author | Christian Heimes <christian@python.org> | 2017-09-15 18:27:30 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-09-15 18:27:30 (GMT) |
commit | a170fa162dc03f0a014373349e548954fff2e567 (patch) | |
tree | ed08062f8462d8b9e98e38b7832e39a85881b4e3 /Lib/ssl.py | |
parent | 4df60f18c64ba2835e68bf3eed08d8002a00f4ac (diff) | |
download | cpython-a170fa162dc03f0a014373349e548954fff2e567.zip cpython-a170fa162dc03f0a014373349e548954fff2e567.tar.gz cpython-a170fa162dc03f0a014373349e548954fff2e567.tar.bz2 |
bpo-31346: Use PROTOCOL_TLS_CLIENT/SERVER (#3058)
Replaces PROTOCOL_TLSv* and PROTOCOL_SSLv23 with PROTOCOL_TLS_CLIENT and
PROTOCOL_TLS_SERVER.
Signed-off-by: Christian Heimes <christian@python.org>
Diffstat (limited to 'Lib/ssl.py')
-rw-r--r-- | Lib/ssl.py | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -522,7 +522,7 @@ def create_default_context(purpose=Purpose.SERVER_AUTH, *, cafile=None, context.load_default_certs(purpose) return context -def _create_unverified_context(protocol=PROTOCOL_TLS, *, cert_reqs=None, +def _create_unverified_context(protocol=PROTOCOL_TLS, *, cert_reqs=CERT_NONE, check_hostname=False, purpose=Purpose.SERVER_AUTH, certfile=None, keyfile=None, cafile=None, capath=None, cadata=None): @@ -541,9 +541,12 @@ def _create_unverified_context(protocol=PROTOCOL_TLS, *, cert_reqs=None, # by default. context = SSLContext(protocol) + if not check_hostname: + context.check_hostname = False if cert_reqs is not None: context.verify_mode = cert_reqs - context.check_hostname = check_hostname + if check_hostname: + context.check_hostname = True if keyfile and not certfile: raise ValueError("certfile must be specified") |