Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
sdogruyol committed Dec 17, 2018
1 parent 5f1ce1e commit 4fefd9c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
14 changes: 10 additions & 4 deletions src/kemal/base.cr
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,18 @@ class Kemal::Base
end

private def start_server(port)
@server = server = HTTP::Server.new(@config.host_binding, port || @config.port, @handlers)
{% if !flag?(:without_openssl) %}
server.tls = config.ssl
@server = server = HTTP::Server.new(@handlers)

{% 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 %}

server.bind
@running = true

yield
Expand Down
2 changes: 1 addition & 1 deletion src/kemal/helpers/file_helpers.cr
Original file line number Diff line number Diff line change
Expand Up @@ -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 ??
request_headers = env.request.headers
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))
gzip = config.serve_static?("gzip")
Expand Down
1 change: 0 additions & 1 deletion src/kemal/main.cr
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
require "http"
require "json"
require "uri"
require "tempfile"
require "./application"
require "./base_log_handler"
require "./cli"
Expand Down

0 comments on commit 4fefd9c

Please sign in to comment.