Method: H2::Server::HTTPS#initialize
- Defined in:
- lib/h2/server/https.rb
#initialize(host:, port:, sni: {}, **options, &on_connection) ⇒ HTTPS
create a new h2 server that uses SNI to determine TLS cert/key to use
SNI options with default callback
- :sni
-
Hash with domain name
Stringkeys andHashvalues: - :cert
-
StringTLS certificate - :extra_chain_cert
-
StringTLS certificate - :key
-
StringTLS key
SNI options with custom callback
- :sni
-
Hash:
- :callback
-
ProccreatesOpenSSL::SSL::SSLContextfor eachconnection
43 44 45 46 47 48 49 50 |
# File 'lib/h2/server/https.rb', line 43 def initialize host:, port:, sni: {}, **, &on_connection @sni = sni @sni_callback = @sni[:callback] || method(:sni_callback) @tcpserver = Celluloid::IO::TCPServer.new host, port @sslserver = Celluloid::IO::SSLServer.new @tcpserver, create_ssl_context() .merge! host: host, port: port, sni: sni super @sslserver, , &on_connection end |