diff options
author | Salim Alam <salam@chef.io> | 2016-03-18 12:31:55 -0700 |
---|---|---|
committer | Salim Alam <salam@chef.io> | 2016-03-21 21:23:08 -0700 |
commit | 3b500ca0714e95584411c109fd6d4000dee9d50e (patch) | |
tree | f46db41dcda7946005a5d445f026249923e8b962 | |
parent | 88e05318bc4409b24e9e5ac45403cfde21ad7006 (diff) | |
download | chef-3b500ca0714e95584411c109fd6d4000dee9d50e.tar.gz |
Update config spec
-rw-r--r-- | chef-config/chef-config.gemspec | 1 | ||||
-rw-r--r-- | chef-config/spec/unit/config_spec.rb | 22 | ||||
-rw-r--r-- | lib/chef/http/basic_client.rb | 1 | ||||
-rw-r--r-- | spec/unit/rest/auth_credentials_spec.rb | 2 |
4 files changed, 25 insertions, 1 deletions
diff --git a/chef-config/chef-config.gemspec b/chef-config/chef-config.gemspec index afbd69f188..100cc54a17 100644 --- a/chef-config/chef-config.gemspec +++ b/chef-config/chef-config.gemspec @@ -17,6 +17,7 @@ Gem::Specification.new do |spec| spec.add_dependency "mixlib-shellout", "~> 2.0" spec.add_dependency "mixlib-config", "~> 2.0" + spec.add_dependency "fuzzyurl", '~> 0.8.0' spec.add_development_dependency "rake", "~> 10.0" diff --git a/chef-config/spec/unit/config_spec.rb b/chef-config/spec/unit/config_spec.rb index 3bada755de..5e3703e9b5 100644 --- a/chef-config/spec/unit/config_spec.rb +++ b/chef-config/spec/unit/config_spec.rb @@ -908,6 +908,28 @@ RSpec.describe ChefConfig::Config do it { is_expected.to eq nil } end + + context "when no_proxy is a domain with a dot prefix" do + let(:env) do + { + "http_proxy" => proxy, + "no_proxy" => ".example.com", + } + end + + it { is_expected.to eq nil } + end + + context "when no_proxy is a domain with no wildcard" do + let(:env) do + { + "http_proxy" => proxy, + "no_proxy" => "example.com", + } + end + + it { is_expected.to eq nil } + end end end diff --git a/lib/chef/http/basic_client.rb b/lib/chef/http/basic_client.rb index 4253701510..3a87fe85e4 100644 --- a/lib/chef/http/basic_client.rb +++ b/lib/chef/http/basic_client.rb @@ -106,6 +106,7 @@ class Chef # match no_proxy with a fuzzy matcher, rather than letting Net::HTTP # do it. http_client = http_client_builder.new(host, port, nil) + http_client.proxy_port = nil if http_client.proxy_address == nil if url.scheme == HTTPS configure_ssl(http_client) diff --git a/spec/unit/rest/auth_credentials_spec.rb b/spec/unit/rest/auth_credentials_spec.rb index dcc0f923b4..2728463c81 100644 --- a/spec/unit/rest/auth_credentials_spec.rb +++ b/spec/unit/rest/auth_credentials_spec.rb @@ -255,7 +255,7 @@ describe Chef::REST::RESTRequest do it "does not configure the proxy user and pass when using https scheme" do http_client = new_request.http_client - expect(http_client.proxy?).to eq(true) + expect(http_client.proxy?).to eq(false) expect(http_client.proxy_user).to be_nil expect(http_client.proxy_pass).to be_nil end |