summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorliris <liris.pp@gmail.com>2014-06-06 10:40:42 +0900
committerliris <liris.pp@gmail.com>2014-06-06 10:40:42 +0900
commitf84554328ead3b76157fed1889bdb79397e464c7 (patch)
tree2992da7efaf5720dc2d5407bf362a7b8e105cb69
parent2971cb4ad06cc37a223766756e94b604d78d9d6a (diff)
parent97923c73a365debc31c5dead5074b32d2bad0483 (diff)
downloadwebsocket-client-f84554328ead3b76157fed1889bdb79397e464c7.tar.gz
Merge pull request #88 from rjschwei/useSystemCerts
System certs
-rw-r--r--websocket/_core.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/websocket/_core.py b/websocket/_core.py
index 8e43cf3..7981c67 100644
--- a/websocket/_core.py
+++ b/websocket/_core.py
@@ -419,8 +419,12 @@ class WebSocket(object):
if is_secure:
if HAVE_SSL:
- sslopt = dict(cert_reqs=ssl.CERT_REQUIRED,
- ca_certs=os.path.join(os.path.dirname(__file__), "cacert.pem"))
+ sslopt = dict(cert_reqs=ssl.CERT_REQUIRED)
+ certPath = os.path.join(
+ os.path.dirname(__file__), "cacert.pem")
+ )
+ if os.path.isfile(certPath):
+ sslopt['ca_certs'] = certPath
sslopt.update(self.sslopt)
self.sock = ssl.wrap_socket(self.sock, **sslopt)
match_hostname(self.sock.getpeercert(), hostname)