Close HTTP connections

This commit is contained in:
alteredCoder 2022-02-09 15:37:06 +01:00
parent ab667b6779
commit e978bf7b33
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