mirror of https://github.com/aredn/aredn.git
Include cookies when testing services. (#1600)
* Include cookies when testing services. Some services use various redirects which involve cookies. If we dont include a cookie jar for these tests, they fail when they should pass. * Fix potential file handle leak
This commit is contained in:
parent
8c863f35dd
commit
4f6fe904f3
|
@ -233,7 +233,10 @@ local function get(validate)
|
|||
hostname = m.hostname
|
||||
port = m.port
|
||||
end
|
||||
local status, effective_url = io.popen("/usr/bin/curl --max-time 10 --retry 0 --connect-timeout 2 --speed-time 5 --speed-limit 1000 --silent --output /dev/null --location --write-out '%{http_code} %{url_effective}' " .. "http://" .. hostname .. ":" .. port .. path):read("*a"):match("^(%d+) (.*)")
|
||||
local cf = io.popen("/usr/bin/curl --max-time 10 --retry 0 --connect-timeout 2 --speed-time 5 --speed-limit 1000 --silent --output /dev/null --cookie-jar /tmp/service-test-cookies --location --write-out '%{http_code} %{url_effective}' " .. "http://" .. hostname .. ":" .. port .. path)
|
||||
local status, effective_url = cf:read("*a"):match("^(%d+) (.*)")
|
||||
cf:close()
|
||||
os.remove("/tmp/service-test-cookies")
|
||||
if status == "200" or status == "401" then
|
||||
vstate[service] = last
|
||||
elseif status == "301" or status == "302" or status == "303" or status == "307" or status == "308" then
|
||||
|
|
Loading…
Reference in New Issue