2019-04-09 00:40:36 +02:00
|
|
|
--- a/Lib/ssl.py
|
|
|
|
+++ b/Lib/ssl.py
|
|
|
|
@@ -537,7 +537,15 @@ class SSLSocket(socket):
|
2015-02-25 17:42:06 +01:00
|
|
|
self._context = SSLContext(ssl_version)
|
|
|
|
self._context.verify_mode = cert_reqs
|
|
|
|
if ca_certs:
|
|
|
|
- self._context.load_verify_locations(ca_certs)
|
|
|
|
+ capath = None
|
|
|
|
+ cafile = None
|
|
|
|
+ if os.path.isdir(ca_certs):
|
|
|
|
+ capath = ca_certs
|
|
|
|
+ else:
|
|
|
|
+ cafile = ca_certs
|
|
|
|
+ self._context.load_verify_locations(cafile=cafile, capath=capath)
|
|
|
|
+ elif cert_reqs != CERT_NONE:
|
|
|
|
+ self._context.set_default_verify_paths()
|
|
|
|
if certfile:
|
|
|
|
self._context.load_cert_chain(certfile, keyfile)
|
|
|
|
if npn_protocols:
|