mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
add check_hostname arg to ssl._create_stdlib_context()
This commit is contained in:
parent
a5768f7292
commit
a02c69a73b
2 changed files with 5 additions and 2 deletions
|
@ -405,7 +405,7 @@ def create_default_context(purpose=Purpose.SERVER_AUTH, *, cafile=None,
|
|||
|
||||
|
||||
def _create_stdlib_context(protocol=PROTOCOL_SSLv23, *, cert_reqs=None,
|
||||
purpose=Purpose.SERVER_AUTH,
|
||||
check_hostname=False, purpose=Purpose.SERVER_AUTH,
|
||||
certfile=None, keyfile=None,
|
||||
cafile=None, capath=None, cadata=None):
|
||||
"""Create a SSLContext object for Python stdlib modules
|
||||
|
@ -424,6 +424,7 @@ def _create_stdlib_context(protocol=PROTOCOL_SSLv23, *, cert_reqs=None,
|
|||
|
||||
if cert_reqs is not None:
|
||||
context.verify_mode = cert_reqs
|
||||
context.check_hostname = check_hostname
|
||||
|
||||
if keyfile and not certfile:
|
||||
raise ValueError("certfile must be specified")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue