diff options
-rw-r--r-- | lib/chef/http.rb | 2 | ||||
-rw-r--r-- | spec/unit/http_spec.rb | 7 |
2 files changed, 8 insertions, 1 deletions
diff --git a/lib/chef/http.rb b/lib/chef/http.rb index 8d00a38dc1..5e52337aff 100644 --- a/lib/chef/http.rb +++ b/lib/chef/http.rb @@ -203,7 +203,7 @@ class Chef def create_url(path) return path if path.is_a?(URI) - if path =~ /^(http|https):\/\// + if path =~ /^(http|https):\/\//i URI.parse(path) elsif path.nil? or path.empty? URI.parse(@url) diff --git a/spec/unit/http_spec.rb b/spec/unit/http_spec.rb index 60d36eb4a0..ddfc56583d 100644 --- a/spec/unit/http_spec.rb +++ b/spec/unit/http_spec.rb @@ -44,6 +44,13 @@ describe Chef::HTTP do expect(http.create_url('///api/endpoint?url=http://foo.bar')).to eql(URI.parse('http://www.getchef.com/organization/org/api/endpoint?url=http://foo.bar')) end + # As per: https://github.com/opscode/chef/issues/2500 + it 'should treat scheme part of the URI in a case-insensitive manner' do + http = Chef::HTTP.allocate # Calling Chef::HTTP::new sets @url, don't want that. + expect { http.create_url('HTTP://www1.chef.io/') }.not_to raise_error + expect(http.create_url('HTTP://www2.chef.io/')).to eql(URI.parse('http://www2.chef.io/')) + end + end # create_url describe "head" do |