File tree 1 file changed +3
-6
lines changed
1 file changed +3
-6
lines changed Original file line number Diff line number Diff line change @@ -386,7 +386,9 @@ def _verify_peercerts_impl(
386
386
policies = None
387
387
trust = None
388
388
try :
389
- if server_hostname is not None :
389
+ # Only set a hostname on the policy if we're verifying the hostname
390
+ # on the leaf certificate.
391
+ if server_hostname is not None and ssl_context .check_hostname :
390
392
cf_str_hostname = None
391
393
try :
392
394
cf_str_hostname = _bytes_to_cf_string (server_hostname .encode ("ascii" ))
@@ -539,11 +541,6 @@ def _verify_peercerts_impl_macos_10_14(
539
541
or cf_error_code == CFConst .errSecCertificateExpired
540
542
):
541
543
is_trusted = True
542
- elif (
543
- not ssl_context .check_hostname
544
- and cf_error_code == CFConst .errSecHostNameMismatch
545
- ):
546
- is_trusted = True
547
544
548
545
# If we're still not trusted then we start to
549
546
# construct and raise the SSLCertVerificationError.
You can’t perform that action at this time.
0 commit comments