Use Flate::Writer.open (#394)
This commit is contained in:
parent
ce10f7d31d
commit
902d87c0a7
1 changed files with 1 additions and 1 deletions
|
@ -134,7 +134,7 @@ def send_file(env : HTTP::Server::Context, path : String, mime_type : String? =
|
||||||
end
|
end
|
||||||
elsif request_headers.includes_word?("Accept-Encoding", "deflate") && config.is_a?(Hash) && config["gzip"]? == true && filesize > minsize && Kemal::Utils.zip_types(file_path)
|
elsif request_headers.includes_word?("Accept-Encoding", "deflate") && config.is_a?(Hash) && config["gzip"]? == true && filesize > minsize && Kemal::Utils.zip_types(file_path)
|
||||||
env.response.headers["Content-Encoding"] = "deflate"
|
env.response.headers["Content-Encoding"] = "deflate"
|
||||||
Flate::Writer.new(env.response) do |deflate|
|
Flate::Writer.open(env.response) do |deflate|
|
||||||
IO.copy(file, deflate)
|
IO.copy(file, deflate)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in a new issue