From 845ccb10ab2248e16ffba6a2b1ec1bd13109a1d1 Mon Sep 17 00:00:00 2001 From: Luna Date: Thu, 3 Sep 2020 22:46:19 -0300 Subject: [PATCH] don't overwrite content-length if its already there we shouldn't overwrite something that the client likely did it willlingly --- src/kemal/ext/response.cr | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/kemal/ext/response.cr b/src/kemal/ext/response.cr index 6fd4c01..1d11dd1 100644 --- a/src/kemal/ext/response.cr +++ b/src/kemal/ext/response.cr @@ -2,7 +2,7 @@ class HTTP::Server::Response class Output def close # ameba:disable Style/NegatedConditionsInUnless - unless response.wrote_headers? && !response.headers.has_key?("Content-Range") + if !response.wrote_headers? && !response.headers.has_key?("Content-Range") && !response.headers.has_key?("Content-Length") response.content_length = @out_count end