Skip to content

Commit 4552e78

Browse files
committed
Merge pull request #812 from docker/811-unix-adapter
Fix Unix adapter bug with newer versions of requests
2 parents fad509b + 326049c commit 4552e78

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

docker/unixconn/unixconn.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,12 +73,20 @@ def get_connection(self, url, proxies=None):
7373
if pool:
7474
return pool
7575

76-
pool = UnixHTTPConnectionPool(url,
77-
self.socket_path,
78-
self.timeout)
76+
pool = UnixHTTPConnectionPool(
77+
url, self.socket_path, self.timeout
78+
)
7979
self.pools[url] = pool
8080

8181
return pool
8282

83+
def request_url(self, request, proxies):
84+
# The select_proxy utility in requests errors out when the provided URL
85+
# doesn't have a hostname, like is the case when using a UNIX socket.
86+
# Since proxies are an irrelevant notion in the case of UNIX sockets
87+
# anyway, we simply return the path URL directly.
88+
# See also: https://github.com/docker/docker-py/issues/811
89+
return request.path_url
90+
8391
def close(self):
8492
self.pools.clear()

0 commit comments

Comments
 (0)