fix ssl connections for python 2.7 (rhbz#619276)

(without breaking earlier python versions)
This commit is contained in:
Mike McLean 2010-12-07 16:04:07 -05:00
parent 8ac3cae252
commit 7876bc06fe
2 changed files with 6 additions and 2 deletions

View file

@ -63,7 +63,7 @@ class SSLConnection:
c, a = self.__dict__["conn"].accept()
return (SSLConnection(c), a)
def makefile(self, mode, bufsize):
def makefile(self, mode='r', bufsize=-1):
"""
We need to use socket._fileobject Because SSL.Connection
doesn't have a 'dup'. Not exactly sure WHY this is, but

View file

@ -41,7 +41,11 @@ class PlgSSL_Transport(xmlrpclib.Transport):
# Yay for Python 2.2
pass
_host, _port = urllib.splitport(host)
self._https = SSLCommon.PlgHTTPS(_host, (_port and int(_port) or 443), ssl_context=self.ssl_ctx, timeout=self._timeout)
if hasattr(xmlrpclib.Transport, 'single_request'):
cnx_class = SSLCommon.PlgHTTPSConnection
else:
cnx_class = SSLCommon.PlgHTTPS
self._https = cnx_class(_host, (_port and int(_port) or 443), ssl_context=self.ssl_ctx, timeout=self._timeout)
return self._https
def close(self):