ruby-changes:47153
From: rhe <ko1@a...>
Date: Wed, 5 Jul 2017 18:06:04 +0900 (JST)
Subject: [ruby-changes:47153] rhe:r59268 (trunk): un.rb: use OpenSSL::PKey.read instead of OpenSSL::PKey::RSA.new
rhe 2017-07-05 18:05:53 +0900 (Wed, 05 Jul 2017) New Revision: 59268 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=59268 Log: un.rb: use OpenSSL::PKey.read instead of OpenSSL::PKey::RSA.new Also, error out if --ssl-private-key option is not given, since specifying only the certificate makes no sense. [Feature #13714] Modified files: trunk/lib/un.rb Index: lib/un.rb =================================================================== --- lib/un.rb (revision 59267) +++ lib/un.rb (revision 59268) @@ -329,11 +329,12 @@ def httpd https://github.com/ruby/ruby/blob/trunk/lib/un.rb#L329 opt = options[name] and (options[name] = Integer(opt)) rescue nil end if cert = options[:SSLCertificate] + key = options[:SSLPrivateKey] or + raise "--ssl-private-key option must also be given" require 'webrick/https' - require 'openssl' - options[:SSLCertificate] = OpenSSL::X509::Certificate.new(File.read(cert)) options[:SSLEnable] = true - options[:SSLPrivateKey] &&= OpenSSL::PKey::RSA.new(File.read(options[:SSLPrivateKey])) + options[:SSLCertificate] = OpenSSL::X509::Certificate.new(File.read(cert)) + options[:SSLPrivateKey] = OpenSSL::PKey.read(File.read(key)) options[:Port] ||= 8443 # HTTPS Alternate end options[:Port] ||= 8080 # HTTP Alternate -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/