[ruby-dev:50178] [Ruby trunk Feature#13729][Assigned] PATCH: Add Server Name Indication (SNI) support to WEBrick
From:
hsbt@...
Date:
2017-07-18 00:00:24 UTC
List:
ruby-dev #50178
Issue #13729 has been updated by hsbt (Hiroshi SHIBATA).
Status changed from Closed to Assigned
Assignee set to normalperson (Eric Wong)
----------------------------------------
Feature #13729: PATCH: Add Server Name Indication (SNI) support to WEBrick
https://bugs.ruby-lang.org/issues/13729#change-65821
* Author: Tietew (Toru Iwase)
* Status: Assigned
* Priority: Normal
* Assignee: normalperson (Eric Wong)
* Target version:
----------------------------------------
WEBrick に Server Name Indication (SNI) サポートを追加するパッチです。
よくWEBrickで簡易サーバを立てているのですが、SNIでバーチャルホストを立てたかった(けどできなかった)のでパッチを書きました。
`WEBrick::HTTPServer` が元々持っているバーチャルホストの仕組みに乗っかっています。
一応テストも入っています。
Google Chrome + Let's Encryptの証明書(SANではない単一CNの証明書複数)でちゃんと接続できることも確認しました。
usage:
~~~ ruby
# master (default) server
master = WEBrick::HTTPSerevr.new({
:ServerName => "master.example.com",
:Port => 443,
:SSLEnable => true,
:SSLCertificate => "CN=master.example.com の証明書",
:SSLPrivateKey => "秘密鍵",
})
master.mount_proc("/") { |req, res| res.body = "default host!\n" }
# virtual host
vhost = WEBrick::HTTPServer.new({
:ServerName => "vhost.example.jp", # SNIバーチャルホスト名
:Port => 443, # master serverと同じポート番号を指定
:DoNotListen => true, # true必須
:SSLEnable => true, # true必須
:SSLCertificate => "CN=vhost.example.jp の証明書",
:SSLPrivateKey => "秘密鍵",
})
vhost.mount_proc("/") { |req, res| res.body = "virtual host!\n" }
master.virtual_host(vhost)
master.start
~~~
---Files--------------------------------
webrick_sni_support.patch (5.16 KB)
webrick_sni_support_fix.patch (6.12 KB)
--
https://bugs.ruby-lang.org/