Update to use HTTP::Server#bind_ssl (#477)

This commit is contained in:
Johannes Müller 2018-08-08 23:13:45 +02:00 committed by Serdar Dogruyol
parent 64fbe406d5
commit b39c974a90
1 changed files with 9 additions and 5 deletions

View File

@ -39,10 +39,6 @@ module Kemal
server = config.server ||= HTTP::Server.new(config.handlers)
{% if !flag?(:without_openssl) %}
config.server.not_nil!.tls = config.ssl
{% end %}
config.running = true
yield config
@ -51,7 +47,15 @@ module Kemal
return unless config.running
unless server.each_address { |_| break true }
server.bind_tcp(config.host_binding, config.port)
{% if flag?(:without_openssl) %}
server.bind_tcp(config.host_binding, config.port)
{% else %}
if ssl = config.ssl
server.bind_ssl(config.host_binding, config.port, ssl)
else
server.bind_tcp(config.host_binding, config.port)
end
{% end %}
end
display_startup_message(config, server)