From e978bf7b330fe0dcd01a6802b50693952f6568a3 Mon Sep 17 00:00:00 2001 From: alteredCoder Date: Wed, 9 Feb 2022 15:37:06 +0100 Subject: [PATCH] Close HTTP connections --- lib/crowdsec.lua | 1 + lib/plugins/crowdsec/recaptcha.lua | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/crowdsec.lua b/lib/crowdsec.lua index a0b2adc..0b47fad 100644 --- a/lib/crowdsec.lua +++ b/lib/crowdsec.lua @@ -100,6 +100,7 @@ function get_http_request(link) ['User-Agent'] = runtime.userAgent }, }) + httpc:close() return res, err end diff --git a/lib/plugins/crowdsec/recaptcha.lua b/lib/plugins/crowdsec/recaptcha.lua index dd94ccf..cfe0fc1 100644 --- a/lib/plugins/crowdsec/recaptcha.lua +++ b/lib/plugins/crowdsec/recaptcha.lua @@ -86,7 +86,7 @@ function M.Validate(g_captcha_res, remote_ip) local data = table_to_encoded_url(body) local httpc = http.new() - httpc:set_timeout(1000) + httpc:set_timeout(2000) local res, err = httpc:request_uri(recaptcha_verify_url, { method = "POST", body = data, @@ -94,6 +94,7 @@ function M.Validate(g_captcha_res, remote_ip) ["Content-Type"] = "application/x-www-form-urlencoded", }, }) + httpc:close() if err ~= nil then return true, err end