aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/apt-panopticon.lua
diff options
context:
space:
mode:
authoronefang2020-01-01 19:03:15 +1000
committeronefang2020-01-01 19:03:15 +1000
commit9c9226dced67b0e18fbc67cd31ccda585f39b322 (patch)
tree27c6ec94e318d1498909275940a86662e2fc67c0 /apt-panopticon.lua
parentCut down on lower bandwidth files to HEAD check. (diff)
downloadapt-panopticon-9c9226dced67b0e18fbc67cd31ccda585f39b322.zip
apt-panopticon-9c9226dced67b0e18fbc67cd31ccda585f39b322.tar.gz
apt-panopticon-9c9226dced67b0e18fbc67cd31ccda585f39b322.tar.bz2
apt-panopticon-9c9226dced67b0e18fbc67cd31ccda585f39b322.tar.xz
Curl will try IPv4 as a backup if IPv6 fails, and we don't want that.
Tell it not to. Also detect if IPv6 is even available.
Diffstat (limited to 'apt-panopticon.lua')
-rwxr-xr-xapt-panopticon.lua8
1 files changed, 5 insertions, 3 deletions
diff --git a/apt-panopticon.lua b/apt-panopticon.lua
index aa089b1..057fc40 100755
--- a/apt-panopticon.lua
+++ b/apt-panopticon.lua
@@ -265,6 +265,7 @@ checkHEAD = function (host, URL, r, retry, sanity)
265 -header "" - add extra headers. 265 -header "" - add extra headers.
266 -L - DO follow redirects. 266 -L - DO follow redirects.
267 --max-redirs n - set maximum redirects, default is 50, -1 = unlimited. 267 --max-redirs n - set maximum redirects, default is 50, -1 = unlimited.
268 -4 or -6 - Only use IPv4 or IPv6
268 --retry n - maximum retries, default is 0, no retries. 269 --retry n - maximum retries, default is 0, no retries.
269 -o file - write to file instead of stdout. 270 -o file - write to file instead of stdout.
270 --path-as-is - https://curl.haxx.se/libcurl/c/CURLOPT_PATH_AS_IS.html might be useful for URLSanity. 271 --path-as-is - https://curl.haxx.se/libcurl/c/CURLOPT_PATH_AS_IS.html might be useful for URLSanity.
@@ -274,7 +275,7 @@ checkHEAD = function (host, URL, r, retry, sanity)
274 -D file - write the received headers to a file. This includes the status code and string. 275 -D file - write the received headers to a file. This includes the status code and string.
275 ]] 276 ]]
276 local status = APT.exe( 277 local status = APT.exe(
277 'curl -I --retry 0 -s --path-as-is --connect-timeout ' .. APT.options.timeout.value .. ' --max-redirs 0 ' .. 278 'curl -I --retry 0 -s --path-as-is --connect-timeout ' .. APT.options.timeout.value .. ' --max-redirs 0 ' .. APT.IPv46 .. ' ' ..
278 IP .. ' ' .. '-o /dev/null -D results/"HEADERS_' .. fname .. '" ' .. 279 IP .. ' ' .. '-o /dev/null -D results/"HEADERS_' .. fname .. '" ' ..
279 hdr .. ' -w "#%{http_code} %{ssl_verify_result} %{url_effective}\\n" ' .. PU.scheme .. '://' .. host .. PU.path .. ' >>results/"STATUS_' .. fname .. '"' 280 hdr .. ' -w "#%{http_code} %{ssl_verify_result} %{url_effective}\\n" ' .. PU.scheme .. '://' .. host .. PU.path .. ' >>results/"STATUS_' .. fname .. '"'
280 ):Nice():log():Do().status 281 ):Nice():log():Do().status
@@ -519,6 +520,7 @@ local download = "curl" ..
519 " --create-dirs -f -L" .. 520 " --create-dirs -f -L" ..
520 " --fail-early" .. 521 " --fail-early" ..
521 " --max-time " .. APT.options.maxtime.value .. 522 " --max-time " .. APT.options.maxtime.value ..
523 APT.IPv46 .. ' ' ..
522 " --retry " .. APT.options.retries.value .. 524 " --retry " .. APT.options.retries.value ..
523 " -R -v -z 'results/stamp.old' --stderr results/" 525 " -R -v -z 'results/stamp.old' --stderr results/"
524local downloads = function(host, URL, meta, release, list) 526local downloads = function(host, URL, meta, release, list)
@@ -1025,9 +1027,9 @@ if 0 < #arg then
1025 APT.allpairs(ips, 1027 APT.allpairs(ips,
1026 function(k, v) 1028 function(k, v)
1027 if v == "A" then 1029 if v == "A" then
1028 if APT.testing("IPv4") then APT.exe("./apt-panopticon.lua " .. sendArgs .. " " .. pu.host .. path .. " " .. k .. " " .. file):Nice():log():fork() end 1030 if APT.testing("IPv4") then APT.exe('./apt-panopticon.lua ' .. sendArgs .. ' -4 ' .. pu.host .. path .. ' ' .. k .. ' ' .. file):Nice():log():fork() end
1029 elseif v == "AAAA" then 1031 elseif v == "AAAA" then
1030 if APT.testing("IPv6") then APT.exe("./apt-panopticon.lua " .. sendArgs .. " " .. pu.host .. path .. " " .. k .. " " .. file):Nice():log():fork() end 1032 if APT.testing("IPv6") then APT.exe('./apt-panopticon.lua ' .. sendArgs .. ' -6 ' .. APT.IPv46 .. ' ' .. pu.host .. path .. ' ' .. k .. ' ' .. file):Nice():log():fork() end
1031 end 1033 end
1032 D('logging to ' .. APT.logName(pu.host, k, file)[2]) 1034 D('logging to ' .. APT.logName(pu.host, k, file)[2])
1033 end 1035 end