diff options
author | Jon Cowie <jonlives@gmail.com> | 2014-12-29 13:54:17 +0000 |
---|---|---|
committer | Jon Cowie <jonlives@gmail.com> | 2014-12-29 13:54:17 +0000 |
commit | b7b7dad4e476b3fde67f0d9881e15efe7e5b60ac (patch) | |
tree | e9e5abc720c817c5c9c911b2797c90a4a024a14e | |
parent | 151e18fc0ebf1597498a65008f02a760b1737ef0 (diff) | |
parent | b46ffba02dd4ea6b5df944f1d8d8d97f66570833 (diff) | |
download | chef-b7b7dad4e476b3fde67f0d9881e15efe7e5b60ac.tar.gz |
Merge pull request #2708 from opscode/jonlives/2505
Merge pull request #2505 from kwilczynski/http-create-url
-rw-r--r-- | CHANGELOG.md | 1 | ||||
-rw-r--r-- | DOC_CHANGES.md | 9 | ||||
-rw-r--r-- | RELEASE_NOTES.md | 4 | ||||
-rw-r--r-- | lib/chef/http.rb | 2 | ||||
-rw-r--r-- | spec/unit/http_spec.rb | 7 |
5 files changed, 15 insertions, 8 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index f93aa4c453..a8d9628347 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ Typo fixes * [**Tim Smith**](https://github.com/tas50) Typo fixes +* [Pull 2505](https://github.com/opscode/chef/pull/2505) Make Chef handle URIs in a case-insensitive manner ### Chef Contributions * ruby 1.9.3 support is dropped diff --git a/DOC_CHANGES.md b/DOC_CHANGES.md index b1121e2bf4..bcf3a27286 100644 --- a/DOC_CHANGES.md +++ b/DOC_CHANGES.md @@ -1,8 +1,3 @@ -<!--- -This file is reset every time a new release is done. This file describes changes that have not yet been released. - -Example Doc Change: -### Headline for the required change -Description of the required change. ---> +### Chef now handles URI Schemes in a case insensitive manner +Previously, when a URI scheme contained all uppercase letters, Chef would reject the URI as invalid. In compliance with RFC3986, Chef now treats URI schemes in a case insensitive manner. This applies to all resources which accept URIs such as remote_file etc.
\ No newline at end of file diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index 630aa737df..a99d44bc56 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -8,6 +8,10 @@ The package resource on OpenBSD is wired up to use the new OpenBSD package provider to install via pkg_add on OpenBSD systems. +## Case Insensitive URI Handling + +Previously, when a URI scheme contained all uppercase letters, Chef would reject the URI as invalid. In compliance with RFC3986, Chef now treats URI schemes in a case insensitive manner. + # Chef Client Release Notes 12.0.0: # Internal API Changes in this Release 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 |