Merge pull request #26 from crowdsecurity/close_http_connection

Close HTTP connections
This commit is contained in:
AlteredCoder 2022-02-09 15:39:50 +01:00 committed by GitHub
commit f8eac632a9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 1 deletions

View file

@ -100,6 +100,7 @@ function get_http_request(link)
['User-Agent'] = runtime.userAgent
},
})
httpc:close()
return res, err
end

View file

@ -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