prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  http: allow reading proxies from the current environment
  This was something enabled as default by the requests, but not on aiohttp. We have to explicitly enable it to keep the current behavior. https://docs.aiohttp.org/en/stable/client_advanced.html#proxy-support. Discord context: https://discord.com/channels/485586884165107732/563406153334128681/891230518992052274
  
  </issue>
  <code>
  [start of dvc/fs/http.py]
  1 import threading
  2 
  3 from funcy import cached_property, memoize, wrap_with
  4 
  5 from dvc import prompt
  6 from dvc.path_info import HTTPURLInfo
  7 from dvc.scheme import Schemes
  8 
  9 from .fsspec_wrapper import FSSpecWrapper, NoDirectoriesMixin
  10 
  11 
  12 @wrap_with(threading.Lock())
  13 @memoize
  14 def ask_password(host, user):
  15     return prompt.password(
  16         "Enter a password for "
  17         "host '{host}' user '{user}'".format(host=host, user=user)
  18     )
  19 
  20 
  21 def make_context(ssl_verify):
  22     if isinstance(ssl_verify, bool) or ssl_verify is None:
  23         return ssl_verify
  24 
  25     # If this is a path, then we will create an
  26     # SSL context for it, and load the given certificate.
  27     import ssl
  28 
  29     context = ssl.create_default_context()
  30     context.load_verify_locations(ssl_verify)
  31     return context
  32 
  33 
  34 # pylint: disable=abstract-method
  35 class HTTPFileSystem(NoDirectoriesMixin, FSSpecWrapper):
  36     scheme = Schemes.HTTP
  37     PATH_CLS = HTTPURLInfo
  38     PARAM_CHECKSUM = "checksum"
  39     REQUIRES = {"aiohttp": "aiohttp", "aiohttp-retry": "aiohttp_retry"}
  40     CAN_TRAVERSE = False
  41 
  42     SESSION_RETRIES = 5
  43     SESSION_BACKOFF_FACTOR = 0.1
  44     REQUEST_TIMEOUT = 60
  45 
  46     def _prepare_credentials(self, **config):
  47         import aiohttp
  48         from fsspec.asyn import fsspec_loop
  49 
  50         from dvc.config import ConfigError
  51 
  52         credentials = {}
  53         client_kwargs = credentials.setdefault("client_kwargs", {})
  54 
  55         if config.get("auth"):
  56             user = config.get("user")
  57             password = config.get("password")
  58             custom_auth_header = config.get("custom_auth_header")
  59 
  60             if password is None and config.get("ask_password"):
  61                 password = ask_password(config.get("url"), user or "custom")
  62 
  63             auth_method = config["auth"]
  64             if auth_method == "basic":
  65                 if user is None or password is None:
  66                     raise ConfigError(
  67                         "HTTP 'basic' authentication require both "
  68                         "'user' and 'password'"
  69                     )
  70 
  71                 client_kwargs["auth"] = aiohttp.BasicAuth(user, password)
  72             elif auth_method == "custom":
  73                 if custom_auth_header is None or password is None:
  74                     raise ConfigError(
  75                         "HTTP 'custom' authentication require both "
  76                         "'custom_auth_header' and 'password'"
  77                     )
  78                 credentials["headers"] = {custom_auth_header: password}
  79             else:
  80                 raise NotImplementedError(
  81                     f"Auth method {auth_method!r} is not supported."
  82                 )
  83 
  84         if "ssl_verify" in config:
  85             with fsspec_loop():
  86                 client_kwargs["connector"] = aiohttp.TCPConnector(
  87                     ssl=make_context(config["ssl_verify"])
  88                 )
  89 
  90         credentials["get_client"] = self.get_client
  91         self.upload_method = config.get("method", "POST")
  92         return credentials
  93 
  94     async def get_client(self, **kwargs):
  95         import aiohttp
  96         from aiohttp_retry import ExponentialRetry, RetryClient
  97 
  98         kwargs["retry_options"] = ExponentialRetry(
  99             attempts=self.SESSION_RETRIES,
  100             factor=self.SESSION_BACKOFF_FACTOR,
  101             max_timeout=self.REQUEST_TIMEOUT,
  102         )
  103 
  104         # The default timeout for the aiohttp is 300 seconds
  105         # which is too low for DVC's interactions (especially
  106         # on the read) when dealing with large data blobs. We
  107         # unlimit the total time to read, and only limit the
  108         # time that is spent when connecting to the remote server.
  109         kwargs["timeout"] = aiohttp.ClientTimeout(
  110             total=None,
  111             connect=self.REQUEST_TIMEOUT,
  112             sock_connect=self.REQUEST_TIMEOUT,
  113             sock_read=None,
  114         )
  115 
  116         return RetryClient(**kwargs)
  117 
  118     @cached_property
  119     def fs(self):
  120         from fsspec.implementations.http import (
  121             HTTPFileSystem as _HTTPFileSystem,
  122         )
  123 
  124         return _HTTPFileSystem(**self.fs_args)
  125 
  126     def _entry_hook(self, entry):
  127         entry["checksum"] = entry.get("ETag") or entry.get("Content-MD5")
  128         return entry
  129
  [end of dvc/fs/http.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/dvc/fs/http.py b/dvc/fs/http.py
  --- a/dvc/fs/http.py
  +++ b/dvc/fs/http.py
  @@ -87,6 +87,9 @@
                       ssl=make_context(config["ssl_verify"])
                   )
   
  +        # Allow reading proxy configurations from the environment.
  +        client_kwargs["trust_env"] = True
  +
           credentials["get_client"] = self.get_client
           self.upload_method = config.get("method", "POST")
           return credentials
  
verification_info: {"golden_diff": "diff --git a/dvc/fs/http.py b/dvc/fs/http.py\n--- a/dvc/fs/http.py\n+++ b/dvc/fs/http.py\n@@ -87,6 +87,9 @@\n                     ssl=make_context(config[\"ssl_verify\"])\n                 )\n \n+        # Allow reading proxy configurations from the environment.\n+        client_kwargs[\"trust_env\"] = True\n+\n         credentials[\"get_client\"] = self.get_client\n         self.upload_method = config.get(\"method\", \"POST\")\n         return credentials\n", "issue": "http: allow reading proxies from the current environment\nThis was something enabled as default by the requests, but not on aiohttp. We have to explicitly enable it to keep the current behavior. https://docs.aiohttp.org/en/stable/client_advanced.html#proxy-support. Discord context: https://discord.com/channels/485586884165107732/563406153334128681/891230518992052274\n", "before_files": [{"content": "import threading\n\nfrom funcy import cached_property, memoize, wrap_with\n\nfrom dvc import prompt\nfrom dvc.path_info import HTTPURLInfo\nfrom dvc.scheme import Schemes\n\nfrom .fsspec_wrapper import FSSpecWrapper, NoDirectoriesMixin\n\n\n@wrap_with(threading.Lock())\n@memoize\ndef ask_password(host, user):\n    return prompt.password(\n        \"Enter a password for \"\n        \"host '{host}' user '{user}'\".format(host=host, user=user)\n    )\n\n\ndef make_context(ssl_verify):\n    if isinstance(ssl_verify, bool) or ssl_verify is None:\n        return ssl_verify\n\n    # If this is a path, then we will create an\n    # SSL context for it, and load the given certificate.\n    import ssl\n\n    context = ssl.create_default_context()\n    context.load_verify_locations(ssl_verify)\n    return context\n\n\n# pylint: disable=abstract-method\nclass HTTPFileSystem(NoDirectoriesMixin, FSSpecWrapper):\n    scheme = Schemes.HTTP\n    PATH_CLS = HTTPURLInfo\n    PARAM_CHECKSUM = \"checksum\"\n    REQUIRES = {\"aiohttp\": \"aiohttp\", \"aiohttp-retry\": \"aiohttp_retry\"}\n    CAN_TRAVERSE = False\n\n    SESSION_RETRIES = 5\n    SESSION_BACKOFF_FACTOR = 0.1\n    REQUEST_TIMEOUT = 60\n\n    def _prepare_credentials(self, **config):\n        import aiohttp\n        from fsspec.asyn import fsspec_loop\n\n        from dvc.config import ConfigError\n\n        credentials = {}\n        client_kwargs = credentials.setdefault(\"client_kwargs\", {})\n\n        if config.get(\"auth\"):\n            user = config.get(\"user\")\n            password = config.get(\"password\")\n            custom_auth_header = config.get(\"custom_auth_header\")\n\n            if password is None and config.get(\"ask_password\"):\n                password = ask_password(config.get(\"url\"), user or \"custom\")\n\n            auth_method = config[\"auth\"]\n            if auth_method == \"basic\":\n                if user is None or password is None:\n                    raise ConfigError(\n                        \"HTTP 'basic' authentication require both \"\n                        \"'user' and 'password'\"\n                    )\n\n                client_kwargs[\"auth\"] = aiohttp.BasicAuth(user, password)\n            elif auth_method == \"custom\":\n                if custom_auth_header is None or password is None:\n                    raise ConfigError(\n                        \"HTTP 'custom' authentication require both \"\n                        \"'custom_auth_header' and 'password'\"\n                    )\n                credentials[\"headers\"] = {custom_auth_header: password}\n            else:\n                raise NotImplementedError(\n                    f\"Auth method {auth_method!r} is not supported.\"\n                )\n\n        if \"ssl_verify\" in config:\n            with fsspec_loop():\n                client_kwargs[\"connector\"] = aiohttp.TCPConnector(\n                    ssl=make_context(config[\"ssl_verify\"])\n                )\n\n        credentials[\"get_client\"] = self.get_client\n        self.upload_method = config.get(\"method\", \"POST\")\n        return credentials\n\n    async def get_client(self, **kwargs):\n        import aiohttp\n        from aiohttp_retry import ExponentialRetry, RetryClient\n\n        kwargs[\"retry_options\"] = ExponentialRetry(\n            attempts=self.SESSION_RETRIES,\n            factor=self.SESSION_BACKOFF_FACTOR,\n            max_timeout=self.REQUEST_TIMEOUT,\n        )\n\n        # The default timeout for the aiohttp is 300 seconds\n        # which is too low for DVC's interactions (especially\n        # on the read) when dealing with large data blobs. We\n        # unlimit the total time to read, and only limit the\n        # time that is spent when connecting to the remote server.\n        kwargs[\"timeout\"] = aiohttp.ClientTimeout(\n            total=None,\n            connect=self.REQUEST_TIMEOUT,\n            sock_connect=self.REQUEST_TIMEOUT,\n            sock_read=None,\n        )\n\n        return RetryClient(**kwargs)\n\n    @cached_property\n    def fs(self):\n        from fsspec.implementations.http import (\n            HTTPFileSystem as _HTTPFileSystem,\n        )\n\n        return _HTTPFileSystem(**self.fs_args)\n\n    def _entry_hook(self, entry):\n        entry[\"checksum\"] = entry.get(\"ETag\") or entry.get(\"Content-MD5\")\n        return entry\n", "path": "dvc/fs/http.py"}]}