Support IP CIDR ranges in NO_PROXY - #1165
Open
turettn wants to merge 2 commits into
Open
Conversation
Merging this PR will not alter performance
Comparing Footnotes
|
turettn
marked this pull request as ready for review
August 26, 2026 17:41
Contributor
|
Thanks, this looks good, can you maybe add two more parametrized tests: This expands test coverage, I think might be helpful |
Co-authored-by: Michiel W. Beijen <mb@x14.nl>
Author
@mbeijen Both added - good thinking! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
From #1164:
The
NO_PROXYstring is currently being properly translated to a URLPattern (e.g.192.168.0.0/16=>all://192.168.0.0/16), but the URLPattern matcher doesn't handle the CIDR.This PR is an attempt to fix the matching logic.
Unit tests provide full code coverage.
scripts/testpasses. As an additional sanity check, this used to fail with "connection refused" since the proxy doesn't exist, but now works on my branch:The most questionable part of this PR is how URLPattern ordering should work. "Check smaller ranges before larger ranges" seems reasonable. "IP addresses & ranges before hosts" seemed like basically a coin flip, so I just picked one.
This is my first PR to httpx2, so if I violated any conventions or you'd like any changes, just let me know. Thanks!
Checklist