This commit is contained in:
sdogruyol 2018-12-17 18:58:02 +03:00
parent 5f1ce1e0fc
commit 4fefd9cb5c
3 changed files with 11 additions and 6 deletions

View file

@ -80,12 +80,18 @@ class Kemal::Base
end end
private def start_server(port) private def start_server(port)
@server = server = HTTP::Server.new(@config.host_binding, port || @config.port, @handlers) @server = server = HTTP::Server.new(@handlers)
{% if !flag?(:without_openssl) %}
server.tls = config.ssl {% if flag?(:without_openssl) %}
server.bind_tcp(@config.host_binding, port || @config.port)
{% else %}
if ssl = config.ssl
server.bind_tls(@config.host_binding, port || @config.port, ssl)
else
server.bind_tcp(@config.host_binding, port || @config.port)
end
{% end %} {% end %}
server.bind
@running = true @running = true
yield yield

View file

@ -22,7 +22,7 @@ module Kemal::FileHelpers
minsize = 860 # http://webmasters.stackexchange.com/questions/31750/what-is-recommended-minimum-object-size-for-gzip-performance-benefits ?? minsize = 860 # http://webmasters.stackexchange.com/questions/31750/what-is-recommended-minimum-object-size-for-gzip-performance-benefits ??
request_headers = env.request.headers request_headers = env.request.headers
filesize = File.size(file_path) filesize = File.size(file_path)
filestat = File.stat(file_path) filestat = File.info(file_path)
config.static_headers.try(&.call(env.response, file_path, filestat)) config.static_headers.try(&.call(env.response, file_path, filestat))
gzip = config.serve_static?("gzip") gzip = config.serve_static?("gzip")

View file

@ -1,7 +1,6 @@
require "http" require "http"
require "json" require "json"
require "uri" require "uri"
require "tempfile"
require "./application" require "./application"
require "./base_log_handler" require "./base_log_handler"
require "./cli" require "./cli"