Verify hostname if verify_mode is CERT_OPTIONAL too.

This commit is contained in:
Guido van Rossum 2013-10-19 09:52:09 -07:00
parent 3743711a96
commit f19a6ef2c9
1 changed files with 1 additions and 1 deletions

View File

@ -604,7 +604,7 @@ class _SelectorSslTransport(_SelectorTransport):
# Verify hostname if requested.
peercert = self._sock.getpeercert()
if (self._server_hostname is not None and
self._sslcontext.verify_mode == ssl.CERT_REQUIRED):
self._sslcontext.verify_mode != ssl.CERT_NONE):
try:
ssl.match_hostname(peercert, self._server_hostname)
except Exception as exc: