We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
requests 2.8.0 re-introduces bug #647


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `docker/unixconn/unixconn.py`
Content:
```
1 # Copyright 2013 dotCloud inc.
2 
3 #    Licensed under the Apache License, Version 2.0 (the "License");
4 #    you may not use this file except in compliance with the License.
5 #    You may obtain a copy of the License at
6 
7 #        http://www.apache.org/licenses/LICENSE-2.0
8 
9 #    Unless required by applicable law or agreed to in writing, software
10 #    distributed under the License is distributed on an "AS IS" BASIS,
11 #    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 #    See the License for the specific language governing permissions and
13 #    limitations under the License.
14 import six
15 import requests.adapters
16 import socket
17 
18 if six.PY3:
19     import http.client as httplib
20 else:
21     import httplib
22 
23 try:
24     import requests.packages.urllib3 as urllib3
25 except ImportError:
26     import urllib3
27 
28 RecentlyUsedContainer = urllib3._collections.RecentlyUsedContainer
29 
30 
31 class UnixHTTPConnection(httplib.HTTPConnection, object):
32     def __init__(self, base_url, unix_socket, timeout=60):
33         httplib.HTTPConnection.__init__(self, 'localhost', timeout=timeout)
34         self.base_url = base_url
35         self.unix_socket = unix_socket
36         self.timeout = timeout
37 
38     def connect(self):
39         sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
40         sock.settimeout(self.timeout)
41         sock.connect(self.unix_socket)
42         self.sock = sock
43 
44 
45 class UnixHTTPConnectionPool(urllib3.connectionpool.HTTPConnectionPool):
46     def __init__(self, base_url, socket_path, timeout=60):
47         urllib3.connectionpool.HTTPConnectionPool.__init__(
48             self, 'localhost', timeout=timeout
49         )
50         self.base_url = base_url
51         self.socket_path = socket_path
52         self.timeout = timeout
53 
54     def _new_conn(self):
55         return UnixHTTPConnection(self.base_url, self.socket_path,
56                                   self.timeout)
57 
58 
59 class UnixAdapter(requests.adapters.HTTPAdapter):
60     def __init__(self, socket_url, timeout=60):
61         socket_path = socket_url.replace('http+unix://', '')
62         if not socket_path.startswith('/'):
63             socket_path = '/' + socket_path
64         self.socket_path = socket_path
65         self.timeout = timeout
66         self.pools = RecentlyUsedContainer(10,
67                                            dispose_func=lambda p: p.close())
68         super(UnixAdapter, self).__init__()
69 
70     def get_connection(self, url, proxies=None):
71         with self.pools.lock:
72             pool = self.pools.get(url)
73             if pool:
74                 return pool
75 
76             pool = UnixHTTPConnectionPool(url,
77                                           self.socket_path,
78                                           self.timeout)
79             self.pools[url] = pool
80 
81         return pool
82 
83     def close(self):
84         self.pools.clear()
85
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/docker/unixconn/unixconn.py b/docker/unixconn/unixconn.py
--- a/docker/unixconn/unixconn.py
+++ b/docker/unixconn/unixconn.py
@@ -73,12 +73,20 @@
             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()

{"golden_diff": "diff --git a/docker/unixconn/unixconn.py b/docker/unixconn/unixconn.py\n--- a/docker/unixconn/unixconn.py\n+++ b/docker/unixconn/unixconn.py\n@@ -73,12 +73,20 @@\n             if pool:\n                 return pool\n \n-            pool = UnixHTTPConnectionPool(url,\n-                                          self.socket_path,\n-                                          self.timeout)\n+            pool = UnixHTTPConnectionPool(\n+                url, self.socket_path, self.timeout\n+            )\n             self.pools[url] = pool\n \n         return pool\n \n+    def request_url(self, request, proxies):\n+        # The select_proxy utility in requests errors out when the provided URL\n+        # doesn't have a hostname, like is the case when using a UNIX socket.\n+        # Since proxies are an irrelevant notion in the case of UNIX sockets\n+        # anyway, we simply return the path URL directly.\n+        # See also: https://github.com/docker/docker-py/issues/811\n+        return request.path_url\n+\n     def close(self):\n         self.pools.clear()\n", "issue": "requests 2.8.0 re-introduces bug #647\n\n", "before_files": [{"content": "# Copyright 2013 dotCloud inc.\n\n#    Licensed under the Apache License, Version 2.0 (the \"License\");\n#    you may not use this file except in compliance with the License.\n#    You may obtain a copy of the License at\n\n#        http://www.apache.org/licenses/LICENSE-2.0\n\n#    Unless required by applicable law or agreed to in writing, software\n#    distributed under the License is distributed on an \"AS IS\" BASIS,\n#    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n#    See the License for the specific language governing permissions and\n#    limitations under the License.\nimport six\nimport requests.adapters\nimport socket\n\nif six.PY3:\n    import http.client as httplib\nelse:\n    import httplib\n\ntry:\n    import requests.packages.urllib3 as urllib3\nexcept ImportError:\n    import urllib3\n\nRecentlyUsedContainer = urllib3._collections.RecentlyUsedContainer\n\n\nclass UnixHTTPConnection(httplib.HTTPConnection, object):\n    def __init__(self, base_url, unix_socket, timeout=60):\n        httplib.HTTPConnection.__init__(self, 'localhost', timeout=timeout)\n        self.base_url = base_url\n        self.unix_socket = unix_socket\n        self.timeout = timeout\n\n    def connect(self):\n        sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)\n        sock.settimeout(self.timeout)\n        sock.connect(self.unix_socket)\n        self.sock = sock\n\n\nclass UnixHTTPConnectionPool(urllib3.connectionpool.HTTPConnectionPool):\n    def __init__(self, base_url, socket_path, timeout=60):\n        urllib3.connectionpool.HTTPConnectionPool.__init__(\n            self, 'localhost', timeout=timeout\n        )\n        self.base_url = base_url\n        self.socket_path = socket_path\n        self.timeout = timeout\n\n    def _new_conn(self):\n        return UnixHTTPConnection(self.base_url, self.socket_path,\n                                  self.timeout)\n\n\nclass UnixAdapter(requests.adapters.HTTPAdapter):\n    def __init__(self, socket_url, timeout=60):\n        socket_path = socket_url.replace('http+unix://', '')\n        if not socket_path.startswith('/'):\n            socket_path = '/' + socket_path\n        self.socket_path = socket_path\n        self.timeout = timeout\n        self.pools = RecentlyUsedContainer(10,\n                                           dispose_func=lambda p: p.close())\n        super(UnixAdapter, self).__init__()\n\n    def get_connection(self, url, proxies=None):\n        with self.pools.lock:\n            pool = self.pools.get(url)\n            if pool:\n                return pool\n\n            pool = UnixHTTPConnectionPool(url,\n                                          self.socket_path,\n                                          self.timeout)\n            self.pools[url] = pool\n\n        return pool\n\n    def close(self):\n        self.pools.clear()\n", "path": "docker/unixconn/unixconn.py"}], "after_files": [{"content": "# Copyright 2013 dotCloud inc.\n\n#    Licensed under the Apache License, Version 2.0 (the \"License\");\n#    you may not use this file except in compliance with the License.\n#    You may obtain a copy of the License at\n\n#        http://www.apache.org/licenses/LICENSE-2.0\n\n#    Unless required by applicable law or agreed to in writing, software\n#    distributed under the License is distributed on an \"AS IS\" BASIS,\n#    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n#    See the License for the specific language governing permissions and\n#    limitations under the License.\nimport six\nimport requests.adapters\nimport socket\n\nif six.PY3:\n    import http.client as httplib\nelse:\n    import httplib\n\ntry:\n    import requests.packages.urllib3 as urllib3\nexcept ImportError:\n    import urllib3\n\nRecentlyUsedContainer = urllib3._collections.RecentlyUsedContainer\n\n\nclass UnixHTTPConnection(httplib.HTTPConnection, object):\n    def __init__(self, base_url, unix_socket, timeout=60):\n        httplib.HTTPConnection.__init__(self, 'localhost', timeout=timeout)\n        self.base_url = base_url\n        self.unix_socket = unix_socket\n        self.timeout = timeout\n\n    def connect(self):\n        sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)\n        sock.settimeout(self.timeout)\n        sock.connect(self.unix_socket)\n        self.sock = sock\n\n\nclass UnixHTTPConnectionPool(urllib3.connectionpool.HTTPConnectionPool):\n    def __init__(self, base_url, socket_path, timeout=60):\n        urllib3.connectionpool.HTTPConnectionPool.__init__(\n            self, 'localhost', timeout=timeout\n        )\n        self.base_url = base_url\n        self.socket_path = socket_path\n        self.timeout = timeout\n\n    def _new_conn(self):\n        return UnixHTTPConnection(self.base_url, self.socket_path,\n                                  self.timeout)\n\n\nclass UnixAdapter(requests.adapters.HTTPAdapter):\n    def __init__(self, socket_url, timeout=60):\n        socket_path = socket_url.replace('http+unix://', '')\n        if not socket_path.startswith('/'):\n            socket_path = '/' + socket_path\n        self.socket_path = socket_path\n        self.timeout = timeout\n        self.pools = RecentlyUsedContainer(10,\n                                           dispose_func=lambda p: p.close())\n        super(UnixAdapter, self).__init__()\n\n    def get_connection(self, url, proxies=None):\n        with self.pools.lock:\n            pool = self.pools.get(url)\n            if pool:\n                return pool\n\n            pool = UnixHTTPConnectionPool(\n                url, self.socket_path, self.timeout\n            )\n            self.pools[url] = pool\n\n        return pool\n\n    def request_url(self, request, proxies):\n        # The select_proxy utility in requests errors out when the provided URL\n        # doesn't have a hostname, like is the case when using a UNIX socket.\n        # Since proxies are an irrelevant notion in the case of UNIX sockets\n        # anyway, we simply return the path URL directly.\n        # See also: https://github.com/docker/docker-py/issues/811\n        return request.path_url\n\n    def close(self):\n        self.pools.clear()\n", "path": "docker/unixconn/unixconn.py"}]}