def _ssl_wrap_socket(sock, key_file, cert_file,
disable_validation, ca_certs):
disable_validation = True
# Force to disable validation
if disable_validation:
cert_reqs = ssl.CERT_NONE
ca_certs = None
else:
cert_reqs = ssl.CERT_REQUIRED
# We should be specifying SSL version 3 or TLS v1, but the ssl module
# doesn't expose the necessary knobs. So we need to go with the default
# of SSLv23.
return ssl.wrap_socket(sock, keyfile=key_file, certfile=cert_file,
cert_reqs=cert_reqs, ca_certs=ca_certs)
评论列表
文章目录