Skip to content
Myr

Fix environment proxies (#2741)

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

* Add red test * Make the test pass * Lint * chanelog ---------

authored by Kar Petrosyan · committed by GitHub · parent 2318fd8 · Browse files · 3 files+5 added−1 removed
This commit

State

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

Trailers

  • Co-authored-by: Karen Petrosyan <92274156+karosis88@users.noreply.github.com>
  • Co-authored-by: Tom Christie <tom@tomchristie.com>

Diff stats

3 files+5 added−1 removed

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

3 files+5 added−1 removed

modified:httpx/_utils.py+3 added-1 removed
225 unmodified lines
226 # which disables "www.google.com" and "google.com".227 # (But not "wwwgoogle.com")228 # NO_PROXY can include domains, IPv6, IPv4 addresses and "localhost"229 # NO_PROXY=example.com,::1,localhost,192.168.0.0/16230 if "://" in hostname:231 mounts[hostname] = None230 if is_ipv4_hostname(hostname):232 elif is_ipv4_hostname(hostname):233 mounts[f"all://{hostname}"] = None234 elif is_ipv6_hostname(hostname):235 mounts[f"all://[{hostname}]"] = None236 elif hostname.lower() == "localhost":
208 unmodified lines
modified:tests/test_utils.py+1 added
195 unmodified lines
196 ({"no_proxy": "::1"}, {"all://[::1]": None}),197 ({"no_proxy": "localhost"}, {"all://localhost": None}),198 ({"no_proxy": "github.com"}, {"all://*github.com": None}),199 ({"no_proxy": ".github.com"}, {"all://*.github.com": None}),200 ({"no_proxy": "http://github.com"}, {"http://github.com": None}),201 ],202)203def test_get_environment_proxies(environment, proxies):204 os.environ.update(environment)
85 unmodified lines
modified:CHANGELOG.md+1 added
10 unmodified lines
11* The `proxies` argument is now deprecated. You should use the `proxy` argument instead, or use `mounts=` for more complex configurations. (#2879)1213### Fixed1415* Handle `NO_PROXY` envvar cases when a fully qualified URL is supplied as the value. (#2741)16* Allow URLs where username or password contains unescaped '@'. (#2986)17* Ensure ASGI `raw_path` does not include URL query component. (#2999)18* Ensure `Response.iter_text()` cannot yield empty strings. (#2998)19
1048 unmodified lines