prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  requests 2.8.0 re-introduces bug #647
  
  
  </issue>
  <code>
  [start of docker/unixconn/unixconn.py]
  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 of docker/unixconn/unixconn.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: 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()
  
verification_info: {"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"}]}