diff options
Diffstat (limited to 'lib/chef/http/basic_client.rb')
| -rw-r--r-- | lib/chef/http/basic_client.rb | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/lib/chef/http/basic_client.rb b/lib/chef/http/basic_client.rb index de5e7c03a8..4cc3732172 100644 --- a/lib/chef/http/basic_client.rb +++ b/lib/chef/http/basic_client.rb @@ -103,14 +103,16 @@ class Chef # 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. - if String === proxy && !proxy.strip.empty? + # + # If `proxy` is not a string or is an empty string, the value will be nil. + proxy = if proxy.is_a?(String) && !proxy.strip.empty? if proxy.match(/^.*:\/\//) - proxy = URI.parse(proxy.strip) + proxy = URI.parse(proxy.strip) else - proxy = URI.parse("#{url.scheme}://#{proxy.strip}") - end + proxy = URI.parse("#{url.scheme}://#{proxy.strip}") + end end - + no_proxy = Chef::Config[:no_proxy] || env['NO_PROXY'] || env['no_proxy'] excludes = no_proxy.to_s.split(/\s*,\s*/).compact excludes = excludes.map { |exclude| exclude =~ /:\d+$/ ? exclude : "#{exclude}:*" } |
