63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
# File 'lib/chef/provider/remote_file/http.rb', line 63
def fetch
http = TargetIO::HTTP.new(uri, http_client_opts)
orig_tempfile = Chef::FileContentManagement::Tempfile.new(@new_resource).tempfile
if want_progress?
tempfile = http.streaming_request_with_progress(uri, , orig_tempfile) do |size, total|
events.resource_update_progress(new_resource, size, total, progress_interval)
end
else
tempfile = http.streaming_request(uri, , orig_tempfile)
end
if tempfile
update_cache_control_data(tempfile, http.last_response)
tempfile.close
else
orig_tempfile.close
orig_tempfile.unlink
end
tempfile
end
|