Skip to content

Commit

Permalink
Added option to specify a root CA file.
Browse files Browse the repository at this point in the history
git-svn-id: https://ruby-httpadapter.googlecode.com/svn/trunk@8 edbb5dda-4979-f80a-53c2-c30fb573866f
  • Loading branch information
Bob Aman committed Jan 13, 2011
1 parent da1d4f7 commit b7fd5ce
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/httpadapter/adapters/net_http.rb
Expand Up @@ -111,6 +111,10 @@ def self.transmit(request, connection=nil)
http.enable_post_connection_check = true
end
http.verify_mode = OpenSSL::SSL::VERIFY_PEER
ca_file = File.expand_path(ENV['CA_FILE'] || '~/.cacert.pem')
if File.exists?(ca_file)
http.ca_file = ca_file
end
store = OpenSSL::X509::Store.new
store.set_default_paths
http.cert_store = store
Expand All @@ -119,7 +123,7 @@ def self.transmit(request, connection=nil)
context.tmp_dh_callback == nil
context.tmp_dh_callback = lambda do |*args|
tmp_dh_key_file = File.expand_path(
ENV['TMP_DH_KEY_FILE'] || "~/.dhparams.pem"
ENV['TMP_DH_KEY_FILE'] || '~/.dhparams.pem'
)
if File.exists?(tmp_dh_key_file)
OpenSSL::PKey::DH.new(File.read(tmp_dh_key_file))
Expand Down

0 comments on commit b7fd5ce

Please sign in to comment.