Changeset

10326:cd1c73c2bdec

net.http.server: Explicitly convert number to string, avoiding implicit coercion
author Kim Alvefur <zash@zash.se>
date Sat, 12 Oct 2019 19:30:29 +0200
parents 10325:f2bbad04cf64
children 10327:34f7a0e8fa59
files net/http/server.lua
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/net/http/server.lua	Sat Oct 12 19:16:43 2019 +0200
+++ b/net/http/server.lua	Sat Oct 12 19:30:29 2019 +0200
@@ -314,7 +314,7 @@
 function _M.send_response(response, body)
 	if response.finished then return; end
 	body = body or response.body or "";
-	response.headers.content_length = #body;
+	response.headers.content_length = ("%d"):format(#body);
 	if response.is_head_request then
 		return _M.send_head_response(response)
 	end