提交 ca9b3870 编写于 作者: J James Myatt

Don't catch ssl.CertificateError in first attempt to wrap_socket

Signed-off-by: NJames Myatt <james@jamesmyatt.co.uk>
上级 8bd03d9e
......@@ -833,6 +833,9 @@ class Client(object):
try:
# Try with server_hostname, even it's not supported in certain scenarios
sock = self._ssl_context.wrap_socket(sock, server_hostname=self._host)
except ssl.CertificateError:
# CertificateError is derived from ValueError
raise
except ValueError:
# Python version requires SNI in order to handle server_hostname, but SNI is not available
sock = self._ssl_context.wrap_socket(sock)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册