From 8b06aa1146faa083226c69eb0aa383ef199b14a4 Mon Sep 17 00:00:00 2001 From: Sam Whited Date: Thu, 6 Oct 2016 13:00:17 -0500 Subject: [PATCH] Fix fetching the SSL socket for Python 3.4 and 3.5 --- slixmpp/xmlstream/xmlstream.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/slixmpp/xmlstream/xmlstream.py b/slixmpp/xmlstream/xmlstream.py index a691d34c..72d2651c 100644 --- a/slixmpp/xmlstream/xmlstream.py +++ b/slixmpp/xmlstream/xmlstream.py @@ -506,7 +506,9 @@ class XMLStream(asyncio.BaseProtocol): else: self.event('ssl_invalid_chain', e) else: - der_cert = transp.get_extra_info("socket").getpeercert(True) + # Workaround for a regression in 3.4 where ssl_object was not set. + der_cert = transp.get_extra_info("ssl_object", + default=transp.get_extra_info("socket")).getpeercert(True) pem_cert = ssl.DER_cert_to_PEM_cert(der_cert) self.event('ssl_cert', pem_cert)