mirror of
https://github.com/python/cpython.git
synced 2025-10-09 16:34:44 +00:00
HTTPSConnection: prefer the context's check_hostname attribute over the constructor parameter (#22959)
This commit is contained in:
parent
b92fd01189
commit
a090f01bb6
4 changed files with 22 additions and 10 deletions
|
@ -1210,8 +1210,8 @@ else:
|
|||
context = ssl._create_default_https_context()
|
||||
will_verify = context.verify_mode != ssl.CERT_NONE
|
||||
if check_hostname is None:
|
||||
check_hostname = will_verify
|
||||
elif check_hostname and not will_verify:
|
||||
check_hostname = context.check_hostname
|
||||
if check_hostname and not will_verify:
|
||||
raise ValueError("check_hostname needs a SSL context with "
|
||||
"either CERT_OPTIONAL or CERT_REQUIRED")
|
||||
if key_file or cert_file:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue