Changed dropped connections / invalid requests to fail silently

This commit is contained in:
rxi
2014-04-12 16:16:09 +01:00
parent 23ee7daad6
commit d481a3ff95

View File

@@ -422,10 +422,14 @@ function lovebird.onRequest(req, client)
if not lovebird.pages[page] then
return "HTTP/1.1 404\r\nContent-Type: text/html\r\n\r\nBad page"
end
-- Handle existent page
return "HTTP/1.1 200 OK\r\nContent-Type: text/html\r\n\r\n" ..
-- Handle page
local str
xpcall(function()
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
@@ -474,7 +478,7 @@ function lovebird.update()
client:settimeout(2)
local addr = client:getsockname()
if lovebird.checkwhitelist(addr) then
xpcall(function() lovebird.onConnect(client) end, lovebird.onError)
xpcall(function() lovebird.onConnect(client) end, function() end)
else
trace("got non-whitelisted connection attempt: ", addr)
client:close()