Kaydet (Commit) 326049c8 authored tarafından Joffrey F's avatar Joffrey F

Fix Unix adapter bug with newer versions of requests

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: 's avatarJoffrey F <joffrey@docker.com>
üst fad509b3
...@@ -73,12 +73,20 @@ class UnixAdapter(requests.adapters.HTTPAdapter): ...@@ -73,12 +73,20 @@ class UnixAdapter(requests.adapters.HTTPAdapter):
if pool: if pool:
return pool return pool
pool = UnixHTTPConnectionPool(url, pool = UnixHTTPConnectionPool(
self.socket_path, url, self.socket_path, self.timeout
self.timeout) )
self.pools[url] = pool self.pools[url] = pool
return 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): def close(self):
self.pools.clear() self.pools.clear()
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