Browse Source

Don't follow the rabbit down the rabbit hole if we are just doing low bandwidth tests.

master
onefang 3 years ago
parent
commit
cd9157a9a9
  1. 34
      apt-panopticon.lua

34
apt-panopticon.lua

@ -370,22 +370,24 @@ checkHEAD = function (host, URL, r, retry, sanity)
checkHEAD(pu.host, location, r + 1, retry, '' ~= sanity)
else
I(spcd .. spcd .. "Redirect to different host. " .. check .. " " .. APT.lnk(URL) .. arw .. APT.lnk(location), host)
--[[ The hard part here is that we end up throwing ALL of the test files at the redirected location.
Not good for deb.debian.org, which we should only be throwing .debs at.
What we do is loop through the DNS entries, and only test the specific protocol & file being tested here.
]]
local u = pu.host .. "/" .. pu.path
local file = pu.path:match(".*/([%w%.%+%-_]*)$") -- Get the filename.
local path = pu.path:sub(2, -1 -(#file))
local check = u:gsub("/", "_")
local extraArgs = sendArgs .. ' -o -r '
if 'https' == pu.scheme then extraArgs = extraArgs .. ' --tests=-http' end
if 'http' == pu.scheme then extraArgs = extraArgs .. ' --tests=-https' end
local pth = path:match('^(.*/pool/).*$')
if nil ~= pth then table.insert(APT.results[PU.scheme].redirects, pu.host .. "/" .. pth) else E(spcd .. spcd .. 'Odd redirect path ' .. path) end
I(spcd .. spcd .. "Now checking redirected host " .. u .. '   for   ' .. APT.lnk(URL) .. arw .. APT.lnk(location), host)
APT.exe(downloadLock .. "REDIR-" .. check .. ".log.txt" .. " ./apt-panopticon.lua " .. extraArgs .. ' ' .. pu.host .. "/" .. path .. " " .. file):Nice():log():fork()
D(spcd .. 'logging to ' .. APT.logName(pu.host, nil, file)[2])
if 1 <= APT.options.bandwidth.value then
--[[ The hard part here is that we end up throwing ALL of the test files at the redirected location.
Not good for deb.debian.org, which we should only be throwing .debs at.
What we do is loop through the DNS entries, and only test the specific protocol & file being tested here.
]]
local u = pu.host .. "/" .. pu.path
local file = pu.path:match(".*/([%w%.%+%-_]*)$") -- Get the filename.
local path = pu.path:sub(2, -1 -(#file))
local check = u:gsub("/", "_")
local extraArgs = sendArgs .. ' -o -r '
if 'https' == pu.scheme then extraArgs = extraArgs .. ' --tests=-http' end
if 'http' == pu.scheme then extraArgs = extraArgs .. ' --tests=-https' end
local pth = path:match('^(.*/pool/).*$')
if nil ~= pth then table.insert(APT.results[PU.scheme].redirects, pu.host .. "/" .. pth) else E(spcd .. spcd .. 'Odd redirect path ' .. path) end
I(spcd .. spcd .. "Now checking redirected host " .. u .. ' &nbsp; for &nbsp; ' .. APT.lnk(URL) .. arw .. APT.lnk(location), host)
APT.exe(downloadLock .. "REDIR-" .. check .. ".log.txt" .. " ./apt-panopticon.lua " .. extraArgs .. ' ' .. pu.host .. "/" .. path .. " " .. file):Nice():log():fork()
D(spcd .. 'logging to ' .. APT.logName(pu.host, nil, file)[2])
end
end
end
end

Loading…
Cancel
Save