summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-12-23 15:06:40 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-12-23 15:06:40 +0000
commit7e9175e3d9f55e1f7d363b1b36e8b1fbf1ff0ec6 (patch)
treec467a6120d4f64188fec398da86a028ea958b5f9 /lib
parente87f45d8a8ee40da9413c19fb4cada7bbcb4a111 (diff)
* lib/open-uri.rb (OpenURI.open_http): accept multiple certs path in
ssl_ca_certs. * tool/downloader.rb: use certs of rubygems for downloading gems. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48941 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r--lib/open-uri.rb13
1 files changed, 8 insertions, 5 deletions
diff --git a/lib/open-uri.rb b/lib/open-uri.rb
index 829759a..71f1eb7 100644
--- a/lib/open-uri.rb
+++ b/lib/open-uri.rb
@@ -295,10 +295,13 @@ module OpenURI
http.verify_mode = options[:ssl_verify_mode] || OpenSSL::SSL::VERIFY_PEER
store = OpenSSL::X509::Store.new
if options[:ssl_ca_cert]
- if File.directory? options[:ssl_ca_cert]
- store.add_path options[:ssl_ca_cert]
- else
- store.add_file options[:ssl_ca_cert]
+ certs = options[:ssl_ca_cert].is_a?(Array) ? options[:ssl_ca_cert] : [options[:ssl_ca_cert]]
+ certs.each do |cert|
+ if File.directory? cert
+ store.add_path cert
+ else
+ store.add_file cert
+ end
end
else
store.set_default_paths
@@ -680,7 +683,7 @@ module OpenURI
#
# [:ssl_ca_cert]
# Synopsis:
- # :ssl_ca_cert=>filename
+ # :ssl_ca_cert=>filename or an Array of filenames
#
# :ssl_ca_cert is used to specify CA certificate for SSL.
# If it is given, default certificates are not used.