From c13fe7f4e9015972ce81cce5ff6d424a126562cb Mon Sep 17 00:00:00 2001 From: ltning <> Date: Sun, 20 Apr 2025 13:32:21 +0000 Subject: [PATCH] Fix detecting of end-of-line on input --- bbs_math.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bbs_math.lua b/bbs_math.lua index 234b1e6..d588b01 100644 --- a/bbs_math.lua +++ b/bbs_math.lua @@ -93,7 +93,7 @@ else break end strval = string.byte(_data) - if strval == 13 or strval == 0 then + if strval == 13 or strval == 0 or strval == nil then -- ngx.say("read done") break else @@ -160,7 +160,7 @@ elseif tonumber(res) then -- The answer did not contain a number, so we're assuming it is nonsensical. else -- Tell the user to give us a sensible answer next time. - ngx.say("\r\n\rBLEEP! Try entering an actual number next time!\r\n\r") + ngx.say("\r\n\rBLEEP! Try entering an actual number next time! ", tostring(res), "\r\n\r") -- Wait for a few seconds (to slow down bots that hammer us) ngx.sleep(3) -- Exit with 403 (which is meaningless here, but the ngx.exit() function