Diff

net/http/server.lua @ 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
parent 10324:3f4c25425589
child 10392:7a95f27ac9d6
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