Commit f19a6ef2 authored by Guido van Rossum's avatar Guido van Rossum

Verify hostname if verify_mode is CERT_OPTIONAL too.

parent 3743711a
......@@ -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:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment