aboutsummaryrefslogtreecommitdiffstats
path: root/net/http/server.lua
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2020-10-13 11:59:40 +0100
committerMatthew Wild <mwild1@gmail.com>2020-10-13 11:59:40 +0100
commitea9edcb9e0ecf62bf56537c3c3f7501c748a0174 (patch)
treee05dcff26b756340fa3cbdeabdba4e8dc717ad38 /net/http/server.lua
parentab1977f889c6a1f8898cca4119d315c1c71a3b0e (diff)
parent181d11c337213c1d0d23fae25ea27229540277b1 (diff)
downloadprosody-ea9edcb9e0ecf62bf56537c3c3f7501c748a0174.tar.gz
prosody-ea9edcb9e0ecf62bf56537c3c3f7501c748a0174.zip
Merge 0.11->trunk
Diffstat (limited to 'net/http/server.lua')
-rw-r--r--net/http/server.lua5
1 files changed, 4 insertions, 1 deletions
diff --git a/net/http/server.lua b/net/http/server.lua
index 0070367a..75859719 100644
--- a/net/http/server.lua
+++ b/net/http/server.lua
@@ -331,7 +331,10 @@ end
function _M.send_response(response, body)
if response.finished then return; end
body = body or response.body or "";
- response.headers.content_length = ("%d"):format(#body);
+ -- Per RFC 7230, informational (1xx) and 204 (no content) should have no c-l header
+ if response.status_code > 199 and response.status_code ~= 204 then
+ response.headers.content_length = ("%d"):format(#body);
+ end
if response.is_head_request then
return _M.send_head_response(response)
end