From a627fdfaaffd456de871ead092c1770d220aec98 Mon Sep 17 00:00:00 2001 From: nagachika Date: Tue, 18 Aug 2015 13:55:06 +0000 Subject: merge revision(s) 49014: * tool/downloader.rb: support old versions of ruby. * tool/downloader.rb: now can download gems by http if openssl is not available (this may be danger!) git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@51635 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- tool/downloader.rb | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) (limited to 'tool/downloader.rb') diff --git a/tool/downloader.rb b/tool/downloader.rb index dd3173bae7..8f169d5849 100644 --- a/tool/downloader.rb +++ b/tool/downloader.rb @@ -1,4 +1,33 @@ require 'open-uri' +begin + require 'net/https' + $rubygems_schema = 'https' + + # open-uri of ruby 2.2.0 accept an array of PEMs as ssl_ca_cert, but old + # versions are not. so, patching OpenSSL::X509::Store#add_file instead. + class OpenSSL::X509::Store + alias orig_add_file add_file + def add_file(pems) + Array(pems).each do |pem| + if File.directory?(pem) + add_path pem + else + orig_add_file pem + end + end + end + end + # since open-uri internally checks ssl_ca_cert by File.directory?, to allow + # accept an array. + class <