aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/apt-panopticon.lua
diff options
context:
space:
mode:
authoronefang2019-12-31 00:19:47 +1000
committeronefang2019-12-31 00:19:47 +1000
commit238e8593a14e46ab0836a939926b193f6e6f122c (patch)
tree29a087c371210b9ea375f70beb407df604542824 /apt-panopticon.lua
parentA lot of tweaking of the logging and reporting, making it easier to read. (diff)
downloadapt-panopticon-238e8593a14e46ab0836a939926b193f6e6f122c.zip
apt-panopticon-238e8593a14e46ab0836a939926b193f6e6f122c.tar.gz
apt-panopticon-238e8593a14e46ab0836a939926b193f6e6f122c.tar.bz2
apt-panopticon-238e8593a14e46ab0836a939926b193f6e6f122c.tar.xz
Clean up if we are retrying a HEAD check.
Diffstat (limited to 'apt-panopticon.lua')
-rwxr-xr-xapt-panopticon.lua20
1 files changed, 11 insertions, 9 deletions
diff --git a/apt-panopticon.lua b/apt-panopticon.lua
index 889058b..2959fc7 100755
--- a/apt-panopticon.lua
+++ b/apt-panopticon.lua
@@ -223,6 +223,17 @@ checkHEAD = function (host, URL, r, retry, sanity)
223 local check = "HEAD testing file" 223 local check = "HEAD testing file"
224 local PU = url.parse(URL, defaultURL) 224 local PU = url.parse(URL, defaultURL)
225 local pu = url.parse(PU.scheme .. "://" .. host, defaultURL) 225 local pu = url.parse(PU.scheme .. "://" .. host, defaultURL)
226 local fname = host .. "_" .. PU.host .. "_" .. PU.path:gsub("/", "_") .. ".txt"
227 local hdr = ""
228 local IP = ""
229 if pu.host ~= PU.host then
230 if "http" == PU.scheme then
231 hdr = '-H "Host: ' .. host .. '"'
232 end
233 IP = '--connect-to "' .. pu.host .. '::' .. PU.host .. ':"'
234 fname = host .. "_" .. pu.host .. '_' .. PU.host .. "_" .. PU.path:gsub("/", "_") .. ".txt"
235 end
236 os.execute('rm -f results/HEADERS_' .. fname .. ' 2>/dev/null; rm -f results/STATUS_' .. fname .. ' 2>/dev/null')
226 if not APT.testing(PU.scheme, host) and APT.redir then I(spcd .. string.upper(PU.scheme) .. " not supported, not tested.   " .. URL, host); return end 237 if not APT.testing(PU.scheme, host) and APT.redir then I(spcd .. string.upper(PU.scheme) .. " not supported, not tested.   " .. URL, host); return end
227 if 0 < r then 238 if 0 < r then
228 check = "Redirecting to" 239 check = "Redirecting to"
@@ -268,15 +279,6 @@ checkHEAD = function (host, URL, r, retry, sanity)
268 Should return with error code 28 on a timeout? 279 Should return with error code 28 on a timeout?
269 -D file - write the received headers to a file. This includes the status code and string. 280 -D file - write the received headers to a file. This includes the status code and string.
270 ]] 281 ]]
271 local fname = host .. "_" .. PU.host .. "_" .. PU.path:gsub("/", "_") .. ".txt"
272 local hdr = ""
273 local IP = ""
274 if pu.host ~= PU.host then
275 if "http" == PU.scheme then
276 hdr = '-H "Host: ' .. host .. '"'
277 end
278 IP = '--connect-to "' .. pu.host .. '::' .. PU.host .. ':"'
279 end
280 local status = APT.exe( 282 local status = APT.exe(
281 'curl -I --retry 0 -s --path-as-is --connect-timeout ' .. APT.options.timeout.value .. ' --max-redirs 0 ' .. 283 'curl -I --retry 0 -s --path-as-is --connect-timeout ' .. APT.options.timeout.value .. ' --max-redirs 0 ' ..
282 IP .. ' ' .. '-o /dev/null -D results/"HEADERS_' .. fname .. '" ' .. 284 IP .. ' ' .. '-o /dev/null -D results/"HEADERS_' .. fname .. '" ' ..