diff options
| author | onefang | 2019-09-29 12:27:52 +1000 |
|---|---|---|
| committer | onefang | 2019-09-29 12:27:52 +1000 |
| commit | addb2ff4ef8a0ada410722ea43e6335f3e4f905d (patch) | |
| tree | 78af16f3b8a02912ee28bbdf5542c978ec2781d8 | |
| parent | checkURL -> checkHEAD (diff) | |
| download | apt-panopticon-addb2ff4ef8a0ada410722ea43e6335f3e4f905d.zip apt-panopticon-addb2ff4ef8a0ada410722ea43e6335f3e4f905d.tar.gz apt-panopticon-addb2ff4ef8a0ada410722ea43e6335f3e4f905d.tar.bz2 apt-panopticon-addb2ff4ef8a0ada410722ea43e6335f3e4f905d.tar.xz | |
checkPaths -> checkFiles
| -rw-r--r-- | README.md | 6 | ||||
| -rwxr-xr-x | mirror-checker.lua | 8 |
2 files changed, 7 insertions, 7 deletions
| @@ -243,10 +243,10 @@ written yet. Note that currently this downloads 4GB per mirror. | |||
| 243 | 243 | ||
| 244 | Calls checkRedirects() with the host as first and second arguments, and | 244 | Calls checkRedirects() with the host as first and second arguments, and |
| 245 | includes the IP this time. The inclusion of the IP causes | 245 | includes the IP this time. The inclusion of the IP causes |
| 246 | checkRedirects() to call checkPaths(). | 246 | checkRedirects() to call checkFiles(). |
| 247 | 247 | ||
| 248 | 248 | ||
| 249 | checkPaths() will call checkHEAD() for each of the reference files. | 249 | checkFiles() will call checkHEAD() for each of the reference files. |
| 250 | 250 | ||
| 251 | 251 | ||
| 252 | checkHEAD() uses LuaSocket (or LuaSec for HTTPS) to send a HEAD request to | 252 | checkHEAD() uses LuaSocket (or LuaSec for HTTPS) to send a HEAD request to |
| @@ -255,5 +255,5 @@ not be followed by that request. If the request returns a redirect, then | |||
| 255 | checkHEAD() is called recursively. If the redirect is to some host we are | 255 | checkHEAD() is called recursively. If the redirect is to some host we are |
| 256 | not already checking, we call checkRedirects() on it, with an IP of | 256 | not already checking, we call checkRedirects() on it, with an IP of |
| 257 | "redir". This causes checkRedirects() to bypass the test that would | 257 | "redir". This causes checkRedirects() to bypass the test that would |
| 258 | otherwise call checkPaths(), instead gathering the IPs and fork as usual. | 258 | otherwise call checkFiles(), instead gathering the IPs and fork as usual. |
| 259 | 259 | ||
diff --git a/mirror-checker.lua b/mirror-checker.lua index 23c7e33..f443789 100755 --- a/mirror-checker.lua +++ b/mirror-checker.lua | |||
| @@ -275,7 +275,7 @@ checkHEAD = function (host, URL, r, retry) | |||
| 275 | end | 275 | end |
| 276 | end | 276 | end |
| 277 | 277 | ||
| 278 | local checkPaths = function (host, ip, path, file) | 278 | local checkFiles = function (host, ip, path, file) |
| 279 | if nil ~= file then | 279 | if nil ~= file then |
| 280 | if "redirect" == ip then ip = host end | 280 | if "redirect" == ip then ip = host end |
| 281 | I(" Checking IP for file " .. host .. " -> " .. ip .. " " .. path .. " " .. file) | 281 | I(" Checking IP for file " .. host .. " -> " .. ip .. " " .. path .. " " .. file) |
| @@ -313,13 +313,13 @@ checkRedirects = function (orig, host, path, ip, file) | |||
| 313 | local po = url.parse("http://" .. orig) | 313 | local po = url.parse("http://" .. orig) |
| 314 | if "" ~= file then | 314 | if "" ~= file then |
| 315 | D("checking redirected file " .. po.host .. " " .. file) | 315 | D("checking redirected file " .. po.host .. " " .. file) |
| 316 | checkPaths(po.host, ip, path, file) | 316 | checkFiles(po.host, ip, path, file) |
| 317 | else | 317 | else |
| 318 | checkPaths(po.host, ip, path) | 318 | checkFiles(po.host, ip, path) |
| 319 | end | 319 | end |
| 320 | else | 320 | else |
| 321 | if orig == host then D("checkRedirects " .. orig .. "" .. file) else D("checkRedirects " .. orig .. " -> " .. host) end | 321 | if orig == host then D("checkRedirects " .. orig .. "" .. file) else D("checkRedirects " .. orig .. " -> " .. host) end |
| 322 | -- TODO - use checkPaths() here ^^^ on the original domain name, coz that's not getting caught yet. I think. | 322 | -- TODO - use checkFiles() here ^^^ on the original domain name, coz that's not getting caught yet. I think. |
| 323 | gatherIPs(ph.host) | 323 | gatherIPs(ph.host) |
| 324 | for k, v in pairs(IP[ph.host]) do | 324 | for k, v in pairs(IP[ph.host]) do |
| 325 | D(" DNS record " .. v .. " " .. ph.host .. " -> " .. k) | 325 | D(" DNS record " .. v .. " " .. ph.host .. " -> " .. k) |
