diff options
author | Joffrey F <joffrey@docker.com> | 2015-10-19 16:55:49 -0700 |
---|---|---|
committer | Joffrey F <joffrey@docker.com> | 2015-10-19 16:55:49 -0700 |
commit | 326049c8bbabd9ec8e3aa42ebf263dd0aa153057 (patch) | |
tree | 1843b8d84a6d264fb37861fce16c5b2154032626 | |
parent | fad509b3bd54258941cbf47a68445c699dc36ce7 (diff) | |
download | docker-py-811-unix-adapter.tar.gz |
Fix Unix adapter bug with newer versions of requests811-unix-adapter
The select_proxy utility in requests errors out when the provided URL
doesn't have a hostname, like is the case when using a UNIX socket.
Since proxies are an irrelevant notion in the case of UNIX sockets
anyway, we simply return the path URL directly.
Signed-off-by: Joffrey F <joffrey@docker.com>
-rw-r--r-- | docker/unixconn/unixconn.py | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/docker/unixconn/unixconn.py b/docker/unixconn/unixconn.py index 551bd29..d7e249e 100644 --- a/docker/unixconn/unixconn.py +++ b/docker/unixconn/unixconn.py @@ -73,12 +73,20 @@ class UnixAdapter(requests.adapters.HTTPAdapter): if pool: return pool - pool = UnixHTTPConnectionPool(url, - self.socket_path, - self.timeout) + pool = UnixHTTPConnectionPool( + url, self.socket_path, self.timeout + ) self.pools[url] = pool return pool + def request_url(self, request, proxies): + # The select_proxy utility in requests errors out when the provided URL + # doesn't have a hostname, like is the case when using a UNIX socket. + # Since proxies are an irrelevant notion in the case of UNIX sockets + # anyway, we simply return the path URL directly. + # See also: https://github.com/docker/docker-py/issues/811 + return request.path_url + def close(self): self.pools.clear() |