summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsand <daniel@spatof.org>2013-05-30 17:20:37 (GMT)
committer sand <daniel@spatof.org>2013-05-30 17:20:37 (GMT)
commitcfe0bc4e1f60cb3842adf23a1c06e95a4dccc0b2 (patch)
tree20fa2ff063e3f31f940be30b4cb6ca62f63d72c9
parent3656dc6a5737da7863a7ee236c93361cf545c960 (diff)
pulizia connessione ssl
-rw-r--r--pinolo/irc.py16
1 files changed, 7 insertions, 9 deletions
diff --git a/pinolo/irc.py b/pinolo/irc.py
index f69f3c7..dc8c677 100644
--- a/pinolo/irc.py
+++ b/pinolo/irc.py
@@ -162,17 +162,15 @@ class IRCConnection(object):
def wrap_ssl(self):
old_socket = self.socket
+ sockopts = dict(do_handshake_on_connect=False)
+ if self.config["ssl_verify"]:
+ sockopts['cert_reqs'] = ssl.CERT_REQUIRED
+ sockopts['ca_certs'] = self.ssl_ca_path
+ else:
+ sockopts['cert_reqs'] = ssl.CERT_NONE
try:
- if self.config["ssl_verify"]:
- self.socket = ssl.wrap_socket(self.socket,
- cert_reqs=ssl.CERT_REQUIRED,
- ca_certs=self.ssl_ca_path,
- do_handshake_on_connect=False)
- else:
- self.socket = ssl.wrap_socket(self.socket,
- cert_reqs=ssl.CERT_NONE,
- do_handshake_on_connect=False)
+ self.socket = ssl.wrap_socket(self.socket, **sockopts)
self.ssl_must_handshake = True
except ssl.SSLError:
raise