2023-07-15 16:27:29 (UTC-03:00)
Marcel Rodrigues <marcelgmr@gmail.com>
randomly close some connections to save resources
diff --git a/lib/ludweb/http.lua b/lib/ludweb/http.lua index cc7911a..a90dcc9 100644 --- a/lib/ludweb/http.lua +++ b/lib/ludweb/http.lua @@ -119,6 +119,10 @@ local function new_http() return nil end local keep_alive = req.headers.connection ~= "close" + -- randomly close some connections to save resources + if keep_alive and math.random(32) == 1 then + keep_alive = false + end local resp = build_response(dataout, status, reason, cookies, keep_alive) return resp, keep_alive end