Browse files

Allow leading dots in no_proxy hostname suffixes

In our network infrastructure the no_proxy environment variable contains host suffixes with leading dots. (e.g: "localhost,.corp")
This normally works with a lot of unix command line tools (git,wget, etc).
The change shouldn't break anything but just allow an optional leading '.' in front of the no_proxy elements
  • Loading branch information...
1 parent c86ece5 commit e2bf6a0b690242dc77aec3e01d3e6b9c5c288141 @databus23 databus23 committed Aug 24, 2012
Showing with 1 addition and 1 deletion.
  1. +1 −1 lib/httpclient.rb
View
2 lib/httpclient.rb
@@ -1045,7 +1045,7 @@ def no_proxy?(uri)
return false
end
@no_proxy.scan(/([^:,]+)(?::(\d+))?/) do |host, port|
- if /(\A|\.)#{Regexp.quote(host)}\z/i =~ uri.host &&
+ if /(\A|\.)#{Regexp.quote(host.gsub(/^\./,''))}\z/i =~ uri.host &&
(!port || uri.port == port.to_i)
return true
end

0 comments on commit e2bf6a0

Please sign in to comment.