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
commit7672305919887537f04441deaf51e68def696f79 (patch)
treee05dcff26b756340fa3cbdeabdba4e8dc717ad38 /net/http/server.lua
parentb0393fe9e1c0a46319cff8de8bb05d7b5dbcff3b (diff)
parent518904b66c472eeef18b85d0d742a72801517abf (diff)
downloadprosody-7672305919887537f04441deaf51e68def696f79.tar.gz
prosody-7672305919887537f04441deaf51e68def696f79.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