aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
Diffstat (limited to '')
-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 .. '" ' ..