http: add IPv6 range support for NO_PROXY environment variable #59950
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.
This PR resolves the
// TODO(joyeecheung): support IPv6.comment ininternal/http.jsby adding comprehensive support for IPv6 address ranges to theNO_PROXYenvironment variable.Previously, the
ProxyConfigclass'sshouldUseProxymethod could only handle IPv4 address ranges. With this change, users can now specify IPv6 ranges (e.g.,::1-::100) to correctly bypass proxies for hosts within those ranges.The implementation involves:
ipv6ToBigIntto convert 128-bit IPv6 addresses intoBigInts for reliable numerical comparison.shouldUseProxylogic to check if a host is within a given IPv6 range.This update ensures the proxy bypass feature is robust and consistent with both IPv4 and IPv6 network standards.
New test cases have been added to
test/client-proxy/test-http-proxy-request-no-proxy-ipv6.mjsto verify the new functionality.Test
::1-::100) correctly bypasses the proxy.This ensures that the new feature works as expected and does not introduce regressions to existing functionality.
/cc @joyeecheung