summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Nichols <tmnichols@gmail.com>2010-05-13 13:49:00 -0400
committerTom Nichols <tmnichols@gmail.com>2010-05-13 13:49:00 -0400
commit8e95ae2948228ddc6d1b32eca2e64b847c756a71 (patch)
treeb610e0387340605ac9fe79a65b933868efa3d1bd
parent341c110b6ad0922cb47494e493fe8075e00cad65 (diff)
downloadslixmpp-8e95ae2948228ddc6d1b32eca2e64b847c756a71.tar.gz
slixmpp-8e95ae2948228ddc6d1b32eca2e64b847c756a71.tar.bz2
slixmpp-8e95ae2948228ddc6d1b32eca2e64b847c756a71.tar.xz
slixmpp-8e95ae2948228ddc6d1b32eca2e64b847c756a71.zip
attempt to add support for self-signed certificate certs
-rw-r--r--sleekxmpp/xmlstream/xmlstream.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/sleekxmpp/xmlstream/xmlstream.py b/sleekxmpp/xmlstream/xmlstream.py
index 54fac422..cdce1fdf 100644
--- a/sleekxmpp/xmlstream/xmlstream.py
+++ b/sleekxmpp/xmlstream/xmlstream.py
@@ -69,6 +69,7 @@ class XMLStream(object):
self.filesocket = None
self.use_ssl = False
self.use_tls = False
+ self.ca_certs=None
self.stream_header = "<stream>"
self.stream_footer = "</stream>"
@@ -112,7 +113,7 @@ class XMLStream(object):
self.socket.settimeout(None)
if self.use_ssl and self.ssl_support:
logging.debug("Socket Wrapped for SSL")
- self.socket = ssl.wrap_socket(self.socket)
+ self.socket = ssl.wrap_socket(self.socket,ca_certs=self.ca_certs)
try:
self.socket.connect(self.address)
#self.filesocket = self.socket.makefile('rb', 0)
@@ -131,8 +132,13 @@ class XMLStream(object):
if self.ssl_support:
logging.info("Negotiating TLS")
self.realsocket = self.socket
- self.socket = ssl.wrap_socket(self.socket, ssl_version=ssl.PROTOCOL_TLSv1, do_handshake_on_connect=False)
+ self.socket = ssl.wrap_socket(self.socket,
+ ssl_version=ssl.PROTOCOL_TLSv1,
+ do_handshake_on_connect=False,
+ ca_certs=self.ca_certs)
+ print "doing handshake..."
self.socket.do_handshake()
+ print "got handshake..."
if sys.version_info < (3,0):
from . filesocket import filesocket
self.filesocket = filesocket(self.socket)