summaryrefslogtreecommitdiff
path: root/lib/chef/resource
diff options
context:
space:
mode:
authordanielsdeleo <dan@opscode.com>2013-05-21 12:50:41 -0700
committerdanielsdeleo <dan@opscode.com>2013-05-23 12:59:13 -0700
commit168ca518c0d83fd27bfc3d9d232f91031777a81c (patch)
treece9ff8ac7e3b216399fc4f4e4fd98f4545633bef /lib/chef/resource
parentb6f45a3fc755b50ee4efcb107f382bb50637eec1 (diff)
downloadchef-168ca518c0d83fd27bfc3d9d232f91031777a81c.tar.gz
Add cache control data to remote file HTTP backend
Add new implementation of cache control header generation in remote file HTTP backend. Will replace existing code in the constructor.
Diffstat (limited to 'lib/chef/resource')
-rw-r--r--lib/chef/resource/remote_file.rb14
1 files changed, 12 insertions, 2 deletions
diff --git a/lib/chef/resource/remote_file.rb b/lib/chef/resource/remote_file.rb
index 899baf4ab8..dd774bcb31 100644
--- a/lib/chef/resource/remote_file.rb
+++ b/lib/chef/resource/remote_file.rb
@@ -35,8 +35,9 @@ class Chef
@source = []
@etag = nil
@last_modified = nil
- @use_etag = true
- @use_last_modified = true
+ @use_conditional_get = false
+ @use_etag = false
+ @use_last_modified = false
@ftp_active_mode = false
@headers = {}
@provider = Chef::Provider::RemoteFile
@@ -60,6 +61,13 @@ class Chef
)
end
+ # Enables the use of both ETag and last modified time-based cache
+ # control. For servers that are behaving correctly, this is the
+ # recommended way to enable conditional GET.
+ def use_conditional_get(args=nil)
+ set_or_return(:use_conditional_get, args, :kind_of => [ TrueClass, FalseClass ])
+ end
+
def etag(args=nil)
# Only store the etag itself, skip the quotes (and leading W/ if it's there)
if args.is_a?(String) && args.include?('"')
@@ -80,6 +88,8 @@ class Chef
)
end
+ alias :use_etags :use_etag
+
def last_modified(args=nil)
if args.is_a?(String)
args = Time.parse(args).gmtime