From 7052c4c25af4c9c6ef314949939a86b7e3e40f5c Mon Sep 17 00:00:00 2001 From: ollo Date: Fri, 29 Mar 2019 18:35:07 +0100 Subject: [PATCH] Moved length calculation after manipulation --- webserver.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/webserver.lua b/webserver.lua index 9f18198..c5d9070 100644 --- a/webserver.lua +++ b/webserver.lua @@ -32,8 +32,6 @@ function sendPage(conn, nameOfFile, replaceMap) local line = file.readline() while (line ~= nil) do - -- increase the amount of sent bytes - sentBytes=sentBytes+string.len(line) -- all placeholder begin with a $, so search for it in the current line if (line:find("$") ~= nil) then @@ -45,6 +43,9 @@ function sendPage(conn, nameOfFile, replaceMap) end end end + -- increase the amount of sent bytes + sentBytes=sentBytes+string.len(line) + buf = buf .. line -- Sent after 500 bytes data