From 657134fd9b88523818ad76442f7a022b2fafdef3 Mon Sep 17 00:00:00 2001 From: onefang Date: Sun, 24 Nov 2019 01:49:54 +1000 Subject: Curl status 28 and 7 should both be treated as timeouts. 28 is the actual timeout status code, 7 means it could not connect, though it still takes a long time to get there. Also clean up thi code a bit. --- apt-panopticon.lua | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'apt-panopticon.lua') diff --git a/apt-panopticon.lua b/apt-panopticon.lua index 8e40449..2058b4e 100755 --- a/apt-panopticon.lua +++ b/apt-panopticon.lua @@ -446,14 +446,14 @@ checkHEAD = function (host, URL, r, retry) hdr .. ' -w "#%{http_code} %{ssl_verify_result} %{url_effective}\\n" ' .. PU.scheme .. '://' .. host .. PU.path .. ' >>results/"STATUS_' .. fname .. '"' local status, result = execute(cmd) os.execute('cat results/"HEADERS_' .. fname .. '" >>results/"STATUS_' .. fname .. '" 2>/dev/null; rm results/"HEADERS_' .. fname .. '" 2>/dev/null') - if "28" == status then - E(" TIMEOUT " .. timeouts + 1 .. ", retry " .. retry + 1, PU.scheme, "", host) - timeouts = timeouts + 1 - checkHEAD(host, URL, r, retry + 1, timeouts) - return - elseif "0" ~= status then + if "0" ~= status then local msg = curlStatus[0 + status] - E(" The curl command return an error code of " .. status .. "- " .. msg, PU.scheme, "", host) + if nil == msg then msg = "UNKNOWN CURL STATUS CODE!" end + E(" The curl command return an error code of " .. status .. " - " .. msg, PU.scheme, "", host) + if ("28" == status) or ("7" == status) then + E(" TIMEOUT " .. timeouts + 1 .. ", retry " .. retry + 1, PU.scheme, "", host) + timeouts = timeouts + 1 + end checkHEAD(host, URL, r, retry + 1, timeouts) return end -- cgit v1.1