diff options
author | Joffrey F <joffrey@docker.com> | 2015-06-24 22:29:11 +0200 |
---|---|---|
committer | Joffrey F <joffrey@docker.com> | 2015-06-30 23:59:03 +0200 |
commit | 9e87884ba8cbddc0c7f2ad7ccdc11e172e844ac6 (patch) | |
tree | 8c312474bb9fa964b42bb5b53fde12b816af2af9 /docker/client.py | |
parent | c8c957c9831acaabc0cd5bb24eaa6e93a9a99e43 (diff) | |
download | docker-py-fix_647.tar.gz |
Fix Unix socket adapter bug with double slash in path + regression testfix_647
Diffstat (limited to 'docker/client.py')
-rw-r--r-- | docker/client.py | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/docker/client.py b/docker/client.py index 0a93248..fdd4fc5 100644 --- a/docker/client.py +++ b/docker/client.py @@ -52,15 +52,16 @@ class Client(requests.Session): base_url = utils.parse_host(base_url) if base_url.startswith('http+unix://'): - unix_socket_adapter = unixconn.UnixAdapter(base_url, timeout) - self.mount('http+docker://', unix_socket_adapter) + self._adapter = unixconn.UnixAdapter(base_url, timeout) + self.mount('http+docker://', self._adapter) self.base_url = 'http+docker://localunixsocket' else: # Use SSLAdapter for the ability to specify SSL version if isinstance(tls, TLSConfig): tls.configure_client(self) elif tls: - self.mount('https://', ssladapter.SSLAdapter()) + self._adapter = ssladapter.SSLAdapter() + self.mount('https://', self._adapter) self.base_url = base_url # version detection needs to be after unix adapter mounting @@ -243,6 +244,14 @@ class Client(requests.Session): def api_version(self): return self._version + def get_adapter(self, url): + try: + return super(Client, self).get_adapter(url) + except requests.exceptions.InvalidSchema as e: + if self._adapter: + return self._adapter + raise e + @check_resource def attach(self, container, stdout=True, stderr=True, stream=False, logs=False): |