diff options
author | Salim Alam <salam@chef.io> | 2016-03-21 15:52:13 -0700 |
---|---|---|
committer | Salim Alam <salam@chef.io> | 2016-03-21 21:23:08 -0700 |
commit | 54934c5101d1c953595d820eb178c8479fdee295 (patch) | |
tree | be13c79f86f35189cbedbab48fbefe0ecae9390b /lib/chef/mixin | |
parent | 3b500ca0714e95584411c109fd6d4000dee9d50e (diff) | |
download | chef-54934c5101d1c953595d820eb178c8479fdee295.tar.gz |
Fix proxified socket
Diffstat (limited to 'lib/chef/mixin')
-rw-r--r-- | lib/chef/mixin/proxified_socket.rb | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/chef/mixin/proxified_socket.rb b/lib/chef/mixin/proxified_socket.rb index c3b0f7688c..5c9bc3c7d0 100644 --- a/lib/chef/mixin/proxified_socket.rb +++ b/lib/chef/mixin/proxified_socket.rb @@ -16,18 +16,22 @@ # require "proxifier" +require "chef-config/mixin/fuzzy_hostname_matcher" class Chef module Mixin module ProxifiedSocket + include ChefConfig::Mixin::FuzzyHostnameMatcher + # This looks at the environment variables and leverages Proxifier to # make the TCPSocket respect ENV['https_proxy'] or ENV['http_proxy'] if # they are present def proxified_socket(host, port) proxy = ENV["https_proxy"] || ENV["http_proxy"] || false - if proxy - Proxifier.Proxy(proxy, no_proxy: ENV["no_proxy"]).open(host, port) + + if proxy && !fuzzy_hostname_match_any?(host, ENV["no_proxy"]) + Proxifier.Proxy(proxy).open(host, port) else TCPSocket.new(host, port) end |