Skip to content
Snippets Groups Projects
Verified Commit fb5991a8 authored by Marek Vavruša's avatar Marek Vavruša Committed by Vladimír Čunát
Browse files

modules/http: added an error handler to HTTP streams

Instead of throwing an error in the HTTP handler, server should log it.
This covers errors like client disconnecting before reading the response
body etc.
parent f5942904
No related branches found
No related tags found
1 merge request!698http-related changes from cloudflare branch
......@@ -322,6 +322,16 @@ function M.add_interface(conf)
ctx = crt and tlscontext(crt, key),
tls = conf.tls,
onstream = routes,
-- Log errors, but do not throw
onerror = function(myserver, context, op, err, errno) -- luacheck: ignore 212
local msg = '[http] ' .. op .. ' on ' .. tostring(context) .. ' failed'
if err then
msg = msg .. ': ' .. tostring(err)
end
if verbose() then
log(msg)
end
end,
}
-- Manually call :listen() so that we are bound before calling :localname()
if s then
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment