summaryrefslogtreecommitdiff
path: root/lib/chef/mixin
diff options
context:
space:
mode:
authorSalim Alam <salam@chef.io>2016-03-21 15:52:13 -0700
committerSalim Alam <salam@chef.io>2016-03-21 21:23:08 -0700
commit54934c5101d1c953595d820eb178c8479fdee295 (patch)
treebe13c79f86f35189cbedbab48fbefe0ecae9390b /lib/chef/mixin
parent3b500ca0714e95584411c109fd6d4000dee9d50e (diff)
downloadchef-54934c5101d1c953595d820eb178c8479fdee295.tar.gz
Fix proxified socket
Diffstat (limited to 'lib/chef/mixin')
-rw-r--r--lib/chef/mixin/proxified_socket.rb8
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