mirror of
https://github.com/TangentFoxy/lovebird.git
synced 2025-07-28 11:02:19 +00:00
Changed dropped connections / invalid requests to fail silently
This commit is contained in:
14
lovebird.lua
14
lovebird.lua
@@ -422,10 +422,14 @@ function lovebird.onRequest(req, client)
|
|||||||
if not lovebird.pages[page] then
|
if not lovebird.pages[page] then
|
||||||
return "HTTP/1.1 404\r\nContent-Type: text/html\r\n\r\nBad page"
|
return "HTTP/1.1 404\r\nContent-Type: text/html\r\n\r\nBad page"
|
||||||
end
|
end
|
||||||
-- Handle existent page
|
-- Handle page
|
||||||
return "HTTP/1.1 200 OK\r\nContent-Type: text/html\r\n\r\n" ..
|
local str
|
||||||
lovebird.template(lovebird.pages[page],
|
xpcall(function()
|
||||||
{ lovebird = lovebird, req = req })
|
str = "HTTP/1.1 200 OK\r\nContent-Type: text/html\r\n\r\n" ..
|
||||||
|
lovebird.template(lovebird.pages[page],
|
||||||
|
{ lovebird = lovebird, req = req })
|
||||||
|
end, lovebird.onError)
|
||||||
|
return str
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@@ -474,7 +478,7 @@ function lovebird.update()
|
|||||||
client:settimeout(2)
|
client:settimeout(2)
|
||||||
local addr = client:getsockname()
|
local addr = client:getsockname()
|
||||||
if lovebird.checkwhitelist(addr) then
|
if lovebird.checkwhitelist(addr) then
|
||||||
xpcall(function() lovebird.onConnect(client) end, lovebird.onError)
|
xpcall(function() lovebird.onConnect(client) end, function() end)
|
||||||
else
|
else
|
||||||
trace("got non-whitelisted connection attempt: ", addr)
|
trace("got non-whitelisted connection attempt: ", addr)
|
||||||
client:close()
|
client:close()
|
||||||
|
Reference in New Issue
Block a user