X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=sfa%2Fclient%2Fsfaserverproxy.py;h=b348126e4f797c5f509fbb68a1e2727c4e0477ef;hb=0d8c502d5ede80349764103f580c4000a8fce97a;hp=18b77131a956bc0a4aead85ad36fc2f5d906172e;hpb=935de64c2ed3a68566da471c68447a1ac384455d;p=sfa.git diff --git a/sfa/client/sfaserverproxy.py b/sfa/client/sfaserverproxy.py index 18b77131..b348126e 100644 --- a/sfa/client/sfaserverproxy.py +++ b/sfa/client/sfaserverproxy.py @@ -51,20 +51,18 @@ class XMLRPCTransport(xmlrpclib.Transport): # host may be a string, or a (host, x509-dict) tuple host, extra_headers, x509 = self.get_host_info(host) if need_HTTPSConnection: - #conn = HTTPSConnection(host, None, key_file=self.key_file, cert_file=self.cert_file, timeout=self.timeout) #**(x509 or {})) - conn = HTTPSConnection(host, None, key_file=self.key_file, cert_file=self.cert_file) #**(x509 or {})) + conn = HTTPSConnection(host, None, key_file=self.key_file, cert_file=self.cert_file) else: - #conn = HTTPS(host, None, key_file=self.key_file, cert_file=self.cert_file, timeout=self.timeout) #**(x509 or {})) - conn = HTTPS(host, None, key_file=self.key_file, cert_file=self.cert_file) #**(x509 or {})) - - if hasattr(conn, 'set_timeout'): - conn.set_timeout(self.timeout) + conn = HTTPS(host, None, key_file=self.key_file, cert_file=self.cert_file) # Some logic to deal with timeouts. It appears that some (or all) versions # of python don't set the timeout after the socket is created. We'll do it # ourselves by forcing the connection to connect, finding the socket, and # calling settimeout() on it. (tested with python 2.6) if self.timeout: + if hasattr(conn, 'set_timeout'): + conn.set_timeout(self.timeout) + if hasattr(conn, "_conn"): # HTTPS is a wrapper around HTTPSConnection real_conn = conn._conn @@ -84,6 +82,7 @@ class XMLRPCTransport(xmlrpclib.Transport): class XMLRPCServerProxy(xmlrpclib.ServerProxy): def __init__(self, url, transport, allow_none=True, verbose=False): # remember url for GetVersion + # xxx not sure this is still needed as SfaServerProxy has this too self.url=url xmlrpclib.ServerProxy.__init__(self, url, transport, allow_none=allow_none, verbose=verbose)