ruby-changes:41791
From: nobu <ko1@a...>
Date: Thu, 18 Feb 2016 16:52:49 +0900 (JST)
Subject: [ruby-changes:41791] nobu:r53865 (trunk): downloader.rb: defer warning
nobu 2016-02-18 16:53:13 +0900 (Thu, 18 Feb 2016) New Revision: 53865 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=53865 Log: downloader.rb: defer warning * tool/downloader.rb (Downloader.download): warn using http only when really downloading. Modified files: trunk/tool/downloader.rb Index: tool/downloader.rb =================================================================== --- tool/downloader.rb (revision 53864) +++ tool/downloader.rb (revision 53865) @@ -35,19 +35,20 @@ class Downloader https://github.com/ruby/ruby/blob/trunk/tool/downloader.rb#L35 @@https = https end + def self.https? + @@https == 'https' + end + def self.https - if @@https != 'https' - warn "*** using http instead of https ***" - end @@https end class GNU < self def self.download(name, *rest) - if https == 'https' + if https? super("https://raw.githubusercontent.com/gcc-mirror/gcc/master/#{name}", name, *rest) else - super("http://repo.or.cz/official-gcc.git/blob_plain/HEAD:/#{name}", name, *rest) + super("https://repo.or.cz/official-gcc.git/blob_plain/HEAD:/#{name}", name, *rest) end end end @@ -58,7 +59,7 @@ class Downloader https://github.com/ruby/ruby/blob/trunk/tool/downloader.rb#L59 require 'rubygems/package' options[:ssl_ca_cert] = Dir.glob(File.expand_path("../lib/rubygems/ssl_certs/*.pem", File.dirname(__FILE__))) file = under(dir, name) - super("#{https}://rubygems.org/downloads/#{name}", file, nil, since, options) or + super("https://rubygems.org/downloads/#{name}", file, nil, since, options) or return false policy = Gem::Security::LowSecurity (policy = policy.dup).ui = Gem::SilentUI.new if policy.respond_to?(:'ui=') @@ -141,6 +142,10 @@ class Downloader https://github.com/ruby/ruby/blob/trunk/tool/downloader.rb#L142 end return true end + if !https? and url.start_with?("https:") + warn "*** using http instead of https ***" + url = url.sub(/\Ahttps/, 'http') + end url = URI(url) if $VERBOSE $stdout.print "downloading #{name} ... " -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/