Merge pull request #168 from enewhuis/master

Fix erroneous argument shadowing
This commit is contained in:
liris
2015-04-01 10:09:34 +09:00

View File

@@ -117,13 +117,13 @@ def _open_socket(addrinfo_list, sockopt, timeout):
return sock return sock
def _ssl_socket(sock, sslopt, hostname): def _ssl_socket(sock, user_sslopt, hostname):
sslopt = dict(cert_reqs=ssl.CERT_REQUIRED) sslopt = dict(cert_reqs=ssl.CERT_REQUIRED)
certPath = os.path.join( certPath = os.path.join(
os.path.dirname(__file__), "cacert.pem") os.path.dirname(__file__), "cacert.pem")
if os.path.isfile(certPath): if os.path.isfile(certPath):
sslopt['ca_certs'] = certPath sslopt['ca_certs'] = certPath
sslopt.update(sslopt) sslopt.update(user_sslopt)
check_hostname = sslopt.pop('check_hostname', True) check_hostname = sslopt.pop('check_hostname', True)
sock = ssl.wrap_socket(sock, **sslopt) 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):