Module: Chef::Mixin::ProxifiedSocket

Defined in:
lib/chef/mixin/proxified_socket.rb

Instance Method Summary collapse

Instance Method Details

#proxified_socket(host, port) ⇒ Object

This looks at the environment variables and leverages Proxifier to make the TCPSocket respect ENV or ENV if they are present



27
28
29
30
31
32
33
34
# File 'lib/chef/mixin/proxified_socket.rb', line 27

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)
  else
    TCPSocket.new(host, port)
  end
end