mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
webrick: add Server Name Indication (SNI)
* lib/webrick/https.rb: servername_cb implementation. * lib/webrick/ssl.rb: abstract servername_cb. * test/webrick/test_https.rb: test. [ruby-dev:50165] [Feature #13729] Author: Tietew <tietew@gmail.com> git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59281 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
4d3d6f6898
commit
08bdbef5ca
3 changed files with 143 additions and 0 deletions
|
@ -48,6 +48,8 @@ module WEBrick
|
|||
# Number of CA certificates to walk when verifying a certificate chain
|
||||
# :SSLVerifyCallback ::
|
||||
# Custom certificate verification callback
|
||||
# :SSLServerNameCallback::
|
||||
# Custom servername indication callback
|
||||
# :SSLTimeout ::
|
||||
# Maximum session lifetime
|
||||
# :SSLOptions ::
|
||||
|
@ -193,10 +195,19 @@ module WEBrick
|
|||
ctx.verify_mode = config[:SSLVerifyClient]
|
||||
ctx.verify_depth = config[:SSLVerifyDepth]
|
||||
ctx.verify_callback = config[:SSLVerifyCallback]
|
||||
ctx.servername_cb = config[:SSLServerNameCallback] || proc { |args| ssl_servername_callback(*args) }
|
||||
ctx.timeout = config[:SSLTimeout]
|
||||
ctx.options = config[:SSLOptions]
|
||||
ctx.ciphers = config[:SSLCiphers]
|
||||
ctx
|
||||
end
|
||||
|
||||
##
|
||||
# ServerNameIndication callback
|
||||
|
||||
def ssl_servername_callback(sslsocket, hostname = nil)
|
||||
# default
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue