Use Flate::Writer.open (#394)

This commit is contained in:
Serdar Dogruyol 2017-11-02 18:49:41 +03:00 committed by GitHub
parent ce10f7d31d
commit 902d87c0a7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -134,7 +134,7 @@ def send_file(env : HTTP::Server::Context, path : String, mime_type : String? =
end
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"
Flate::Writer.new(env.response) do |deflate|
Flate::Writer.open(env.response) do |deflate|
IO.copy(file, deflate)
end
else