Commit bd783f0f authored by Vincent Pelletier's avatar Vincent Pelletier

client: Define HTTP{,S}Connection class to use as class attributes.

So they can be customised in subclasses.
parent b3b4ebf1
......@@ -51,6 +51,8 @@ class CaucaseClient(object):
Expose caucase REST API as pythonic methods.
"""
HTTPConnection = httplib.HTTPConnection
HTTPSConnection = httplib.HTTPSConnection
@classmethod
def updateCAFile(cls, url, ca_crt_path):
......@@ -120,7 +122,7 @@ class CaucaseClient(object):
# XXX: set timeout to HTTP connections ?
http_url = urlparse(ca_url)
port = http_url.port or 80
self._http_connection = httplib.HTTPConnection(
self._http_connection = self.HTTPConnection(
http_url.hostname,
port,
#timeout=,
......@@ -138,7 +140,7 @@ class CaucaseClient(object):
ssl_context.load_cert_chain(user_key)
except ssl.SSLError as exc:
raise ValueError('Failed to load user key: %r' % (exc, ))
self._https_connection = httplib.HTTPSConnection(
self._https_connection = self.HTTPSConnection(
http_url.hostname,
443 if port == 80 else port + 1,
#timeout=,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment