diff options
| author | onefang | 2019-11-24 01:49:54 +1000 |
|---|---|---|
| committer | onefang | 2019-11-24 01:49:54 +1000 |
| commit | 657134fd9b88523818ad76442f7a022b2fafdef3 (patch) | |
| tree | c6f939026f0c0b1893e213ce087602a097483bdf /apt-panopticon.lua | |
| parent | Uncomment the util-linux file test. (diff) | |
| download | apt-panopticon-657134fd9b88523818ad76442f7a022b2fafdef3.zip apt-panopticon-657134fd9b88523818ad76442f7a022b2fafdef3.tar.gz apt-panopticon-657134fd9b88523818ad76442f7a022b2fafdef3.tar.bz2 apt-panopticon-657134fd9b88523818ad76442f7a022b2fafdef3.tar.xz | |
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.
Diffstat (limited to 'apt-panopticon.lua')
| -rwxr-xr-x | apt-panopticon.lua | 14 |
1 files changed, 7 insertions, 7 deletions
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) | |||
| 446 | hdr .. ' -w "#%{http_code} %{ssl_verify_result} %{url_effective}\\n" ' .. PU.scheme .. '://' .. host .. PU.path .. ' >>results/"STATUS_' .. fname .. '"' | 446 | hdr .. ' -w "#%{http_code} %{ssl_verify_result} %{url_effective}\\n" ' .. PU.scheme .. '://' .. host .. PU.path .. ' >>results/"STATUS_' .. fname .. '"' |
| 447 | local status, result = execute(cmd) | 447 | local status, result = execute(cmd) |
| 448 | os.execute('cat results/"HEADERS_' .. fname .. '" >>results/"STATUS_' .. fname .. '" 2>/dev/null; rm results/"HEADERS_' .. fname .. '" 2>/dev/null') | 448 | os.execute('cat results/"HEADERS_' .. fname .. '" >>results/"STATUS_' .. fname .. '" 2>/dev/null; rm results/"HEADERS_' .. fname .. '" 2>/dev/null') |
| 449 | if "28" == status then | 449 | if "0" ~= status then |
| 450 | E(" TIMEOUT " .. timeouts + 1 .. ", retry " .. retry + 1, PU.scheme, "", host) | ||
| 451 | timeouts = timeouts + 1 | ||
| 452 | checkHEAD(host, URL, r, retry + 1, timeouts) | ||
| 453 | return | ||
| 454 | elseif "0" ~= status then | ||
| 455 | local msg = curlStatus[0 + status] | 450 | local msg = curlStatus[0 + status] |
| 456 | E(" The curl command return an error code of " .. status .. "- " .. msg, PU.scheme, "", host) | 451 | if nil == msg then msg = "UNKNOWN CURL STATUS CODE!" end |
| 452 | E(" The curl command return an error code of " .. status .. " - " .. msg, PU.scheme, "", host) | ||
| 453 | if ("28" == status) or ("7" == status) then | ||
| 454 | E(" TIMEOUT " .. timeouts + 1 .. ", retry " .. retry + 1, PU.scheme, "", host) | ||
| 455 | timeouts = timeouts + 1 | ||
| 456 | end | ||
| 457 | checkHEAD(host, URL, r, retry + 1, timeouts) | 457 | checkHEAD(host, URL, r, retry + 1, timeouts) |
| 458 | return | 458 | return |
| 459 | end | 459 | end |
