Replies: 1 comment
|
Confirmed, and the mechanism is a bit worse than "not respected" — the mask isn't ignored, it's parsed as a URL path and dropped, which silently turns the entry into a single-host match.
>>> from httpx2._utils import URLPattern
>>> from httpx2 import URL
>>> p = URLPattern("all://192.168.0.0/16")
>>> p.host, p.host_regex.pattern
('192.168.0.0', '^192\\.168\\.0\\.0$')
>>> [p.matches(URL(u)) for u in ("http://192.168.0.10", "http://192.168.0.0", "http://192.168.5.5")]
[False, True, False]So That's a fail-open shape: traffic you believe is excluded still reaches the proxy. Three things that follow, in case they're useful for #1165:
So: bug, not a docs fix — the comment describes the behaviour people reasonably expect, and silently matching one host out of a /16 is the part that needs to go. |
Uh oh!
There was an error while loading. Please reload this page.
👋 The comments for
get_environment_proxiesimplies that CIDRs are supported in theNO_PROXYenvironment variable:Unfortunately, they aren't actually respected. If you use the
NO_PROXYstring from the comment, and connect tohttp://192.168.0.10, it will still attempt to go through the proxy.This feels like a bug, and the functionality should be added or the comments fixed. Happy to discuss here, and I'll also throw up a PR that attempts to handle CIDRs as a starting point.
All reactions