From: Thierry Parmentelat Date: Thu, 27 Oct 2011 14:35:03 +0000 (+0200) Subject: remove old code X-Git-Tag: sfa-1.1-1~8 X-Git-Url: http://git.onelab.eu/?p=sfa.git;a=commitdiff_plain;h=a0abfee9d08e256b2aaa6624475de6a34490e033 remove old code --- diff --git a/sfa/util/httpsProtocol.py b/sfa/util/httpsProtocol.py deleted file mode 100644 index e6c6be1b..00000000 --- a/sfa/util/httpsProtocol.py +++ /dev/null @@ -1,51 +0,0 @@ -import httplib -import socket -import sys - - -def is_python26(): - return False - #return sys.version_info[0] == 2 and sys.version_info[1] == 6 - -# wrapper around standartd https modules. Properly supports timeouts. - -class HTTPSConnection(httplib.HTTPSConnection): - def __init__(self, host, port=None, key_file=None, cert_file=None, - strict=None, timeout = None): - httplib.HTTPSConnection.__init__(self, host, port, key_file, cert_file, strict) - if timeout: - timeout = float(timeout) - self.timeout = timeout - - def connect(self): - """Connect to a host on a given (SSL) port.""" - if is_python26(): - from sfa.util.ssl_socket import SSLSocket - sock = socket.create_connection((self.host, self.port), self.timeout) - if self._tunnel_host: - self.sock = sock - self._tunnel() - self.sock = SSLSocket(sock, self.key_file, self.cert_file) - else: - sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) - sock.settimeout(self.timeout) - sock.connect((self.host, self.port)) - ssl = socket.ssl(sock, self.key_file, self.cert_file) - self.sock = httplib.FakeSocket(sock, ssl) - -class HTTPS(httplib.HTTPS): - def __init__(self, host='', port=None, key_file=None, cert_file=None, - strict=None, timeout = None): - # urf. compensate for bad input. - if port == 0: - port = None - self._setup(HTTPSConnection(host, port, key_file, cert_file, strict, timeout)) - - # we never actually use these for anything, but we keep them - # here for compatibility with post-1.5.2 CVS. - self.key_file = key_file - self.cert_file = cert_file - - def set_timeout(self, timeout): - if is_python26(): - self._conn.timeout = timeout