This commit is contained in:
liris
2015-03-26 15:06:34 +09:00
parent c0b9ddb59e
commit f434416a1b
2 changed files with 2 additions and 4 deletions

View File

@@ -125,8 +125,7 @@ def _ssl_socket(sock, sslopt):
sslopt.update(sslopt)
check_hostname = sslopt.pop('check_hostname', True)
sock = ssl.wrap_socket(sock, **sslopt)
if (sslopt["cert_reqs"] != ssl.CERT_NONE
and check_hostname):
if (sslopt["cert_reqs"] != ssl.CERT_NONE and check_hostname):
match_hostname(sock.getpeercert(), hostname)

View File

@@ -20,7 +20,7 @@ Copyright (C) 2010 Hiroki Ohtani(liris)
"""
__all__ = ["HAVE_SSL"]
__all__ = ["HAVE_SSL", "SSLError"]
try:
import ssl
@@ -37,5 +37,4 @@ except ImportError:
class SSLError(Exception):
pass
__all__.append("SSLError")
HAVE_SSL = False