Skip to content

Commit

Permalink
Set and use HTTP's cert_store with default certs
Browse files Browse the repository at this point in the history
This attempts to workaround Ruby's 1.8.7 issues with `#ca_file`
usage found in Travis.
  • Loading branch information
luislavena committed Apr 18, 2014
1 parent 07268ef commit 34f8526
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lib/mini_portile.rb
Original file line number Diff line number Diff line change
Expand Up @@ -335,9 +335,16 @@ def download_file_http(url, full_path, count = 3)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_PEER

store = OpenSSL::X509::Store.new

# Auto-include system-provided certificates
store.set_default_paths

if ENV.has_key?("SSL_CERT_FILE") && File.exist?(ENV["SSL_CERT_FILE"])
http.ca_file = ENV["SSL_CERT_FILE"]
store.add_file ENV["SSL_CERT_FILE"]
end

http.cert_store = store
end
end

Expand Down

0 comments on commit 34f8526

Please sign in to comment.