httpclient icon indicating copy to clipboard operation
httpclient copied to clipboard

NO_PROXY should support * wildcard

Open rlaveycal opened this issue 9 years ago • 3 comments

It seems that the content of no_proxy are somewhat arbitrary. The W3C reference states that's it's just domains but that's in the context of Mosaic. Supporting static IP addresses only is too limiting.

Our corporate no_proxy environment variable takes the form of 192.168.*,*.ourdomain.com but httpclient doesn't understand the * and so connections still go through the proxy.

A quick change is to change line 540 of httpclient.rb to replace * with .+

regexp = /(\A|\.)#{Regexp.quote(host).gsub('\*', '.+')}\z/i

Support for CIDR format might also be useful / an alternative (192.168.0.0/16)

I see that #110 also requested a change to no_proxy that didn't progress.

rlaveycal avatar Apr 20 '16 15:04 rlaveycal

I would like to second the request for CIDR support. Some similar libraries support CIDR notation:

  • Ruby's URI class: https://github.com/ruby/ruby/blob/32674b167bddc0d737c38f84722986b0f228b44b/test/uri/test_generic.rb#L844
  • Chromium: https://src.chromium.org/svn/trunk/src/net/proxy/proxy_bypass_rules.cc

FWIW, I've found that most libraries support just leaving out the leading * on domains and they work fine, though having a trailing * support would be almost CIDR-like (though less-standard, I think.)

oifland avatar Jun 14 '16 19:06 oifland

I didn't know URI#find_proxy supports CIDR from 2.4. I agree that CIDR support is good but I'm not sure '*' is good...

nahi avatar Jun 19 '16 06:06 nahi

I'm also looking for support of wildcards and CIDR notation (ruby 2.6). Any rough estimate when this could be available?

tbugfinder avatar Jun 02 '19 18:06 tbugfinder