mirror of
https://github.com/python/cpython.git
synced 2025-09-27 02:39:58 +00:00
Verify hostname if verify_mode is CERT_OPTIONAL too.
This commit is contained in:
parent
3743711a96
commit
f19a6ef2c9
1 changed files with 1 additions and 1 deletions
|
@ -604,7 +604,7 @@ class _SelectorSslTransport(_SelectorTransport):
|
||||||
# Verify hostname if requested.
|
# Verify hostname if requested.
|
||||||
peercert = self._sock.getpeercert()
|
peercert = self._sock.getpeercert()
|
||||||
if (self._server_hostname is not None and
|
if (self._server_hostname is not None and
|
||||||
self._sslcontext.verify_mode == ssl.CERT_REQUIRED):
|
self._sslcontext.verify_mode != ssl.CERT_NONE):
|
||||||
try:
|
try:
|
||||||
ssl.match_hostname(peercert, self._server_hostname)
|
ssl.match_hostname(peercert, self._server_hostname)
|
||||||
except Exception as exc:
|
except Exception as exc:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue