Parent

Files

Class/Module Index [+]

Quicksearch

Chef::Provider::RemoteFile::HTTP

Attributes

current_resource[R]
new_resource[R]
uri[R]

Public Class Methods

new(uri, new_resource, current_resource) click to toggle source

Parse the uri into instance variables

# File lib/chef/provider/remote_file/http.rb, line 36
def initialize(uri, new_resource, current_resource)
  @uri = uri
  @new_resource = new_resource
  @current_resource = current_resource
end

Public Instance Methods

conditional_get_headers() click to toggle source
# File lib/chef/provider/remote_file/http.rb, line 46
def conditional_get_headers
  cache_control_headers = {}
  if last_modified = cache_control_data.mtime and want_mtime_cache_control?
    cache_control_headers["if-modified-since"] = last_modified
  end
  if etag = cache_control_data.etag and want_etag_cache_control?
    cache_control_headers["if-none-match"] = etag
  end
  Chef::Log.debug("Cache control headers: #{cache_control_headers.inspect}")
  cache_control_headers
end
fetch() click to toggle source
# File lib/chef/provider/remote_file/http.rb, line 58
def fetch
  http = Chef::HTTP::Simple.new(uri, http_client_opts)
  tempfile = http.streaming_request(uri, headers)
  if tempfile
    update_cache_control_data(tempfile, http.last_response)
    tempfile.close
  end
  tempfile
end
headers() click to toggle source
# File lib/chef/provider/remote_file/http.rb, line 42
def headers
  conditional_get_headers.merge(new_resource.headers)
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.