mirror of
https://gitea.invidious.io/iv-org/shard-kemal.git
synced 2024-08-15 00:53:36 +00:00
Make static_file_handler#etag private
This commit is contained in:
parent
2fe27f0890
commit
e6af97c256
1 changed files with 2 additions and 2 deletions
|
@ -50,7 +50,7 @@ module Kemal
|
||||||
return call_next(context)
|
return call_next(context)
|
||||||
end
|
end
|
||||||
elsif File.exists?(file_path)
|
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 ??
|
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)
|
context.response.content_type = Utils.mime_type(file_path)
|
||||||
request_headers = context.request.headers
|
request_headers = context.request.headers
|
||||||
|
@ -79,7 +79,7 @@ module Kemal
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def etag(context, file_path)
|
private def etag(context, file_path)
|
||||||
etag = %{W/"#{File.lstat(file_path).mtime.epoch.to_s}"}
|
etag = %{W/"#{File.lstat(file_path).mtime.epoch.to_s}"}
|
||||||
context.response.headers["ETag"] = etag
|
context.response.headers["ETag"] = etag
|
||||||
return false if !context.request.headers["If-None-Match"]? || context.request.headers["If-None-Match"] != etag
|
return false if !context.request.headers["If-None-Match"]? || context.request.headers["If-None-Match"] != etag
|
||||||
|
|
Loading…
Reference in a new issue