Fix detecting of end-of-line on input
This commit is contained in:
parent
2ad005e6d3
commit
c13fe7f4e9
1 changed files with 2 additions and 2 deletions
|
|
@ -93,7 +93,7 @@ else
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
strval = string.byte(_data)
|
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")
|
-- ngx.say("read done")
|
||||||
break
|
break
|
||||||
else
|
else
|
||||||
|
|
@ -160,7 +160,7 @@ elseif tonumber(res) then
|
||||||
-- The answer did not contain a number, so we're assuming it is nonsensical.
|
-- The answer did not contain a number, so we're assuming it is nonsensical.
|
||||||
else
|
else
|
||||||
-- Tell the user to give us a sensible answer next time.
|
-- 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)
|
-- Wait for a few seconds (to slow down bots that hammer us)
|
||||||
ngx.sleep(3)
|
ngx.sleep(3)
|
||||||
-- Exit with 403 (which is meaningless here, but the ngx.exit() function
|
-- Exit with 403 (which is meaningless here, but the ngx.exit() function
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue