class ChefConfig::Config
def self.proxy_uri(scheme, host, port)
set environment variables, unless exluded by no_proxy, in which case nil
Given a scheme, host, and port, return the correct proxy URI based on the
def self.proxy_uri(scheme, host, port) proxy_env_var = ENV["#{scheme}_proxy"].to_s.strip # Check if the proxy string contains a scheme. If not, add the url's scheme to the # proxy before parsing. The regex /^.*:\/\// matches, for example, http://. Reusing proxy # here since we are really just trying to get the string built correctly. proxy = if !proxy_env_var.empty? if proxy_env_var =~ /^.*:\/\// URI.parse(proxy_env_var) else URI.parse("#{scheme}://#{proxy_env_var}") end end return proxy unless fuzzy_hostname_match_any?(host, ENV["no_proxy"]) end