summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/chef/http/basic_client.rb14
-rw-r--r--lib/chef/provider/remote_file/ftp.rb2
2 files changed, 12 insertions, 4 deletions
diff --git a/lib/chef/http/basic_client.rb b/lib/chef/http/basic_client.rb
index b6ae5d9a6f..190635f798 100644
--- a/lib/chef/http/basic_client.rb
+++ b/lib/chef/http/basic_client.rb
@@ -96,7 +96,7 @@ class Chef
end
def proxy_uri
- @proxy_uri ||= ChefConfig::Config.proxy_uri(url.scheme, host, port)
+ @proxy_uri ||= Chef::Config.proxy_uri(url.scheme, host, port)
end
def build_http_client
@@ -120,11 +120,19 @@ class Chef
Net::HTTP
else
Chef::Log.debug("Using #{proxy_uri.host}:#{proxy_uri.port} for proxy")
- Net::HTTP.Proxy(proxy_uri.host, proxy_uri.port, proxy_uri.user,
- proxy_uri.password)
+ Net::HTTP.Proxy(proxy_uri.host, proxy_uri.port, http_proxy_user(proxy_uri),
+ http_proxy_pass(proxy_uri))
end
end
+ def http_proxy_user(proxy_uri)
+ proxy_uri.user || Chef::Config["#{proxy_uri.scheme}_proxy_user"]
+ end
+
+ def http_proxy_pass(proxy_uri)
+ proxy_uri.password || Chef::Config["#{proxy_uri.scheme}_proxy_pass"]
+ end
+
def configure_ssl(http_client)
http_client.use_ssl = true
ssl_policy.apply_to(http_client)
diff --git a/lib/chef/provider/remote_file/ftp.rb b/lib/chef/provider/remote_file/ftp.rb
index f63acdc06c..5935e83301 100644
--- a/lib/chef/provider/remote_file/ftp.rb
+++ b/lib/chef/provider/remote_file/ftp.rb
@@ -147,7 +147,7 @@ class Chef
end
def proxy_uri(uri)
- ChefConfig::Config.proxy_uri("ftp", hostname, port)
+ Chef::Config.proxy_uri("ftp", hostname, port)
end
def parse_path