summaryrefslogtreecommitdiff
path: root/lib/webrick/https.rb
diff options
context:
space:
mode:
authornormal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-07-18 01:59:28 +0000
committernormal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-07-18 01:59:28 +0000
commita6c13d08d7d2035a22855c8f412694d13ba2faa0 (patch)
treea23aa08bf77dc5c81b79b99093883db7f5380fb2 /lib/webrick/https.rb
parent23e9a4ec1691ef7d3054c9c39108acb5cca4bce9 (diff)
webrick: fix SNI support
* lib/webrick/https.rb: check ssl context of virtual host. * lib/webrick/ssl.rb: ensure to return ssl context. * test/webrick/test_https.rb: test returned cert is correct. [Feature #13729][ruby-dev:50173] Author: Tietew <tietew@gmail.com> git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59351 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/webrick/https.rb')
-rw-r--r--lib/webrick/https.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/webrick/https.rb b/lib/webrick/https.rb
index 1494973e74..4826654d3a 100644
--- a/lib/webrick/https.rb
+++ b/lib/webrick/https.rb
@@ -131,5 +131,22 @@ module WEBrick
server = lookup_server(req)
server ? server.ssl_context : nil
end
+
+ # :stopdoc:
+
+ ##
+ # Check whether +server+ is also SSL server.
+ # Also +server+'s SSL context will be created.
+
+ alias orig_virtual_host virtual_host
+
+ def virtual_host(server)
+ if @config[:SSLEnable] && !server.ssl_context
+ raise ArgumentError, "virtual host must set SSLEnable to true"
+ end
+ orig_virtual_host(server)
+ end
+
+ # :startdoc:
end
end