aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorrhe <rhe@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-07-05 09:05:53 +0000
committerrhe <rhe@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-07-05 09:05:53 +0000
commit8c95d46f9e7b006be70a7136b224998fc87e957d (patch)
treee1d1b7da26bb4273eddaa561ea6afffc7c71ce20 /lib
parent38f8c5a39b9215961c4f7ff8d0833acdbddffc0d (diff)
downloadruby-8c95d46f9e7b006be70a7136b224998fc87e957d.tar.gz
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] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59268 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r--lib/un.rb7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/un.rb b/lib/un.rb
index aa86141bf1..c445dba4ec 100644
--- a/lib/un.rb
+++ b/lib/un.rb
@@ -329,11 +329,12 @@ def httpd
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