From e6af97c25696a919eadc62520d945dc3813f1b51 Mon Sep 17 00:00:00 2001 From: Sdogruyol Date: Mon, 27 Feb 2017 19:21:14 +0300 Subject: [PATCH] Make static_file_handler#etag private --- src/kemal/static_file_handler.cr | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/kemal/static_file_handler.cr b/src/kemal/static_file_handler.cr index ce14209..34a37ca 100644 --- a/src/kemal/static_file_handler.cr +++ b/src/kemal/static_file_handler.cr @@ -50,7 +50,7 @@ module Kemal return call_next(context) end elsif File.exists?(file_path) - return if self.etag(context, file_path) + return if etag(context, file_path) minsize = 860 # http://webmasters.stackexchange.com/questions/31750/what-is-recommended-minimum-object-size-for-gzip-performance-benefits ?? context.response.content_type = Utils.mime_type(file_path) request_headers = context.request.headers @@ -79,7 +79,7 @@ module Kemal end end - def etag(context, file_path) + private def etag(context, file_path) etag = %{W/"#{File.lstat(file_path).mtime.epoch.to_s}"} context.response.headers["ETag"] = etag return false if !context.request.headers["If-None-Match"]? || context.request.headers["If-None-Match"] != etag