summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean Cribbs <seancribbs@gmail.com>2009-02-18 19:10:42 -0500
committerSean Cribbs <seancribbs@gmail.com>2009-02-18 19:11:12 -0500
commit986af85a675b5d234e65fd3935ad90f7c09eb670 (patch)
tree81a9741abcf97bc174e67563d5f6118dbc329dd8
parent96ea7d91cb062dd85b21c4d1bbf084e20b9e376b (diff)
downloadchef-986af85a675b5d234e65fd3935ad90f7c09eb670.tar.gz
CHEF-115: Allow remote filenames that begin with 'http', check for whole protocol lead-in.
-rw-r--r--NOTICE2
-rw-r--r--chef/lib/chef/mixin/generate_url.rb2
-rw-r--r--chef/lib/chef/provider/remote_file.rb2
3 files changed, 4 insertions, 2 deletions
diff --git a/NOTICE b/NOTICE
index ebfc2d18c1..200743f3fe 100644
--- a/NOTICE
+++ b/NOTICE
@@ -9,7 +9,7 @@ Contributors and Copyright holders:
* Copyright 2008, Arjuna Christensen <aj@hjksolutions.com>
* Copyright 2008, Bryan McLellan <btm@loftninjas.org>
* Copyright 2008, Ezra Zygmuntowicz <ezra@engineyard.com>
- * Copyright 2008, Sean Cribbs <seancribbs@gmail.com>
+ * Copyright 2009, Sean Cribbs <seancribbs@gmail.com>
Chef incorporates code modified from Open4 (http://www.codeforpeople.com/lib/ruby/open4/), which was written by Ara T. Howard.
diff --git a/chef/lib/chef/mixin/generate_url.rb b/chef/lib/chef/mixin/generate_url.rb
index abb28d6df0..9ebe22b832 100644
--- a/chef/lib/chef/mixin/generate_url.rb
+++ b/chef/lib/chef/mixin/generate_url.rb
@@ -24,7 +24,7 @@ class Chef
def generate_cookbook_url(url, cookbook, type, node, args=nil)
new_url = nil
- if url =~ /^http/
+ if url =~ /^(http|https):\/\//
new_url = url
else
new_url = "cookbooks/#{cookbook}/#{type}?"
diff --git a/chef/lib/chef/provider/remote_file.rb b/chef/lib/chef/provider/remote_file.rb
index 8ceed5f74d..8fd5eb0104 100644
--- a/chef/lib/chef/provider/remote_file.rb
+++ b/chef/lib/chef/provider/remote_file.rb
@@ -91,6 +91,7 @@ class Chef
uri = URI.parse(source)
if uri.absolute
r = Chef::REST.new(source)
+ Chef::Log.debug("Downloading from absolute URI: #{source}")
r.get_rest(source, true).open
end
rescue URI::InvalidURIError
@@ -101,6 +102,7 @@ class Chef
unless Chef::Config[:solo]
r = Chef::REST.new(Chef::Config[:remotefile_url])
url = generate_url(source, "files", :checksum => current_checksum)
+ Chef::Log.debug("Downloading from server: #{url}")
r.get_rest(url, true).open
end
end