You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
URI::Generic.use_proxy? cannot match IPv6 literal addresses in no_proxy #218
URI::Generic.use_proxy? silently ignores IPv6 literal addresses in no_proxy / NO_PROXY, causing IPv6 targets to always be proxied even when they should be excluded.
Root cause
The parsing regex in use_proxy? splits no_proxy entries on colons to extract an optional port:
IPv6 addresses contain colons as part of their syntax (e.g. 2001:db8::1), so this regex mangles them; the address is split into fragments rather than parsed as a host. As a result:
Bare entries like 2001:db8::1 are never correctly captured into p_host
Bracketed entries like [2001:db8::1] are captured literally (with brackets) and never reach the IPAddr.new(p_host).include?(addr) check since IPAddr.new("[2001:db8::1]") raises InvalidAddressError
Bracketed entries with port like [2001:db8::1]:8080 are similarly broken
Reproduction
require'uri'require'resolv'# IPv6 target that should bypass the proxyno_proxy="2001:db8::1"hostname="2001:db8::1"addr=Resolv.getaddress(hostname)rescuehostnameport=80putsURI::Generic.use_proxy?(hostname,addr,port,no_proxy)# Expected: false (should bypass proxy)# Actual: true (incorrectly routes through proxy)
Expected behavior
All three real-world no_proxy formats for IPv6 should be recognized:
Activity
Fix use_proxy? to correctly handle IPv6 addresses in no_proxy