electrum

Electrum Bitcoin wallet
git clone https://git.parazyd.org/electrum
Log | Files | Refs | Submodules

commit 0c0da6a36da7fac5bc963204d6762ca3f55ca424
parent 6c6293c777a0256a32f12e4665545e11167386bb
Author: ThomasV <thomasv@gitorious>
Date:   Sun, 28 Sep 2014 23:19:52 +0200

use certs from request module in interface.py

Diffstat:
Mlib/interface.py | 11++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/lib/interface.py b/lib/interface.py @@ -23,6 +23,10 @@ import socks import socket import ssl +import requests +ca_path = requests.certs.where() +print ca_path + from version import ELECTRUM_VERSION, PROTOCOL_VERSION from util import print_error, print_msg from simple_config import SimpleConfig @@ -37,7 +41,6 @@ import util - def Interface(server, config = None): host, port, protocol = server.split(':') port = int(port) @@ -169,11 +172,9 @@ class TcpInterface(threading.Thread): s = self.get_simple_socket() if s is None: return - # try with CA first try: - ca_certs = os.path.join(self.config.path, 'ca', 'ca-bundle.crt') - s = ssl.wrap_socket(s, ssl_version=ssl.PROTOCOL_SSLv3, cert_reqs=ssl.CERT_REQUIRED, ca_certs=ca_certs, do_handshake_on_connect=True) + s = ssl.wrap_socket(s, ssl_version=ssl.PROTOCOL_SSLv3, cert_reqs=ssl.CERT_REQUIRED, ca_certs=ca_path, do_handshake_on_connect=True) except ssl.SSLError, e: s = None if s and self.check_host_name(s.getpeercert(), self.host): @@ -242,7 +243,7 @@ class TcpInterface(threading.Thread): return print_error("wrong certificate", self.host) return - except Exception: + except BaseException: print_error("wrap_socket failed", self.host) traceback.print_exc(file=sys.stderr) return