Skip to content
Myr

Handle bare env proxy hostname gracefully (#1120)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Joe · committed by GitHub · parent 682cad3 · Browse files · 2 files+4 added−1 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+4 added−1 removed

  • tests:+2 added−0 removed
  • other:+2 added−1 removed

2 files+4 added−1 removed

modified:httpx/_utils.py+2 added-1 removed
309 unmodified lines
310 mounts: typing.Dict[str, typing.Optional[str]] = {}311312 for scheme in ("http", "https", "all"):313 if proxy_info.get(scheme):314 mounts[scheme] = proxy_info[scheme]314 hostname = proxy_info[scheme]315 mounts[scheme] = hostname if "://" in hostname else f"http://{hostname}"316317 no_proxy_hosts = [host.strip() for host in proxy_info.get("no", "").split(",")]318 for hostname in no_proxy_hosts:319 # See https://curl.haxx.se/libcurl/c/CURLOPT_NOPROXY.html for details
223 unmodified lines
modified:tests/client/test_proxies.py+2 added
141 unmodified lines
142 "http://google.com",143 {"HTTP_PROXY": "http://example.com"},144 "http://example.com",145 ),146 # Auto prepend http scheme147 ("http://google.com", {"HTTP_PROXY": "example.com"}, "http://example.com"),148 (149 "http://google.com",150 {"HTTP_PROXY": "http://example.com", "NO_PROXY": "google.com"},151 None,
95 unmodified lines