Skip to content

Commit

Permalink
Support for https uris in download_file
Browse files Browse the repository at this point in the history
  • Loading branch information
joerichsen authored and Dan Croak committed Dec 15, 2010
1 parent 06d1c80 commit 6c6f7d0
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion template/suspenders.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@ def action_mailer_host(rails_env, host)

def download_file(uri_string, destination)
uri = URI.parse(uri_string)
contents = Net::HTTP.get(uri)
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true if uri_string =~ /^https/
request = Net::HTTP::Get.new(uri.path)
contents = http.request(request).body
path = File.join(destination_root, destination)
File.open(path, "w") { |file| file.write(contents) }
end
Expand Down

0 comments on commit 6c6f7d0

Please sign in to comment.