aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--README.md18
-rwxr-xr-xmirror-checker.lua16
2 files changed, 17 insertions, 17 deletions
diff --git a/README.md b/README.md
index fe62f04..347049b 100644
--- a/README.md
+++ b/README.md
@@ -190,19 +190,19 @@ Active mirrors keyed by the FDQN, include the listed Protocols as a sub
190table. Write this table to results/mirrors.lua so that the forked tests 190table. Write this table to results/mirrors.lua so that the forked tests
191can read it. 191can read it.
192 192
193Remove the mirror site from the mirrors table, then checkRedirects() it 193Remove the mirror site from the mirrors table, then checkHost() it
194first. 194first.
195 195
196checkRedirects() deb.devuan.org, the DNS RR. 196checkHost() deb.devuan.org, the DNS RR.
197 197
198Loop through the mirrors table, and checkRedirects() each one. 198Loop through the mirrors table, and checkHost() each one.
199 199
200Wait for all forked tests to finish. 200Wait for all forked tests to finish.
201 201
202Delete results/*.check. 202Delete results/*.check.
203 203
204 204
205The checkRedirects() function does this - 205The checkHost() function does this -
206 206
207If there is no second argument, then the host is set to the first 207If there is no second argument, then the host is set to the first
208argument, otherwise the host is the second argument. 208argument, otherwise the host is the second argument.
@@ -222,7 +222,7 @@ ionice -c3 ./mirror-checker.lua example.com/path x.x.x.x &
222 222
223ionice -c3 ./mirror-checker.lua example.com/path [x:x:x:x:x:x] & 223ionice -c3 ./mirror-checker.lua example.com/path [x:x:x:x:x:x] &
224 224
225For each CNAME, it checkRedirects() the host, but with the CNAME as a 225For each CNAME, it checkHost() the host, but with the CNAME as a
226second argument. 226second argument.
227 227
228SRV reconds don't do anything yet, coz I have yet to see one from my test 228SRV reconds don't do anything yet, coz I have yet to see one from my test
@@ -241,9 +241,9 @@ directory, downloads the reference files using wget. While it should
241actually perform the Integrity and Updated tests now, those haven't been 241actually perform the Integrity and Updated tests now, those haven't been
242written yet. Note that currently this downloads 4GB per mirror. 242written yet. Note that currently this downloads 4GB per mirror.
243 243
244Calls checkRedirects() with the host as first and second arguments, and 244Calls checkHost() with the host as first and second arguments, and
245includes the IP this time. The inclusion of the IP causes 245includes the IP this time. The inclusion of the IP causes
246checkRedirects() to call checkFiles(). 246checkHost() to call checkFiles().
247 247
248 248
249checkFiles() will call checkHEAD() for each of the reference files. 249checkFiles() will call checkHEAD() for each of the reference files.
@@ -253,7 +253,7 @@ checkHEAD() uses LuaSocket (or LuaSec for HTTPS) to send a HEAD request to
253the IP, with a Host header set to the original host name. Redirects will 253the IP, with a Host header set to the original host name. Redirects will
254not be followed by that request. If the request returns a redirect, then 254not be followed by that request. If the request returns a redirect, then
255checkHEAD() is called recursively. If the redirect is to some host we are 255checkHEAD() is called recursively. If the redirect is to some host we are
256not already checking, we call checkRedirects() on it, with an IP of 256not already checking, we call checkHost() on it, with an IP of
257"redir". This causes checkRedirects() to bypass the test that would 257"redir". This causes checkHost() to bypass the test that would
258otherwise call checkFiles(), instead gathering the IPs and fork as usual. 258otherwise call checkFiles(), instead gathering the IPs and fork as usual.
259 259
diff --git a/mirror-checker.lua b/mirror-checker.lua
index f443789..81b32db 100755
--- a/mirror-checker.lua
+++ b/mirror-checker.lua
@@ -215,7 +215,7 @@ checkHEAD = function (host, URL, r, retry)
215 local f = io.popen(string.format('if [ ! -f results/%s.check ] ; then touch results/%s.check; echo -n "check"; fi', file:gsub("/", "_"), file:gsub("/", "_") )):read("*a") 215 local f = io.popen(string.format('if [ ! -f results/%s.check ] ; then touch results/%s.check; echo -n "check"; fi', file:gsub("/", "_"), file:gsub("/", "_") )):read("*a")
216 if (nil == f) or ("check" == f) then 216 if (nil == f) or ("check" == f) then
217 I(" Now checking redirected host " .. file) 217 I(" Now checking redirected host " .. file)
218 checkRedirects(host, host, nil, "redir", pl.path) 218 checkHost(host, host, nil, "redir", pl.path)
219 else 219 else
220 D(" Already checking " .. file) 220 D(" Already checking " .. file)
221 end 221 end
@@ -304,7 +304,7 @@ local execute = function (s)
304 os.execute(s) 304 os.execute(s)
305end 305end
306 306
307checkRedirects = function (orig, host, path, ip, file) 307checkHost = function (orig, host, path, ip, file)
308 if nil == host then host = orig end 308 if nil == host then host = orig end
309 if nil == path then path = "" end 309 if nil == path then path = "" end
310 if nil == file then file = "" end 310 if nil == file then file = "" end
@@ -318,7 +318,7 @@ checkRedirects = function (orig, host, path, ip, file)
318 checkFiles(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("checkHost " .. orig .. "" .. file) else D("checkHost " .. orig .. " -> " .. host) end
322-- TODO - use checkFiles() 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
@@ -328,7 +328,7 @@ checkRedirects = function (orig, host, path, ip, file)
328 elseif v == "AAAA" then 328 elseif v == "AAAA" then
329 if testing("IPv6") then execute("ionice -c3 ./mirror-checker.lua " .. sendArgs .. " " .. orig .. path .. " [" .. k .. "] " .. file .. " &") end 329 if testing("IPv6") then execute("ionice -c3 ./mirror-checker.lua " .. sendArgs .. " " .. orig .. path .. " [" .. k .. "] " .. file .. " &") end
330 elseif v == "CNAME" then 330 elseif v == "CNAME" then
331 checkRedirects(orig, k, path, ip, file) -- Check the original, with the DNS records from the CNAME. Do not check the CNAME, it's just a source of IPs. 331 checkHost(orig, k, path, ip, file) -- Check the original, with the DNS records from the CNAME. Do not check the CNAME, it's just a source of IPs.
332 elseif v == "SRV" then 332 elseif v == "SRV" then
333 print("SVR record found, now what do we do?") 333 print("SVR record found, now what do we do?")
334 end 334 end
@@ -510,7 +510,7 @@ if 0 < #arg then
510 checkExes(downloadLock) 510 checkExes(downloadLock)
511 end 511 end
512 end 512 end
513 checkRedirects(pu.host, pu.host, pu.path, arg[2], arg[3]) 513 checkHost(pu.host, pu.host, pu.path, arg[2], arg[3])
514 logFile:close() 514 logFile:close()
515else 515else
516 if not keep then os.execute("rm -f results/*.log") end 516 if not keep then os.execute("rm -f results/*.log") end
@@ -523,9 +523,9 @@ else
523 mirrors = getMirrors() 523 mirrors = getMirrors()
524--print(dumpTable(mirrors, "", "mirrors")) 524--print(dumpTable(mirrors, "", "mirrors"))
525 mirrors[options.referenceSite.value] = nil 525 mirrors[options.referenceSite.value] = nil
526 checkRedirects(options.referenceSite.value) 526 checkHost(options.referenceSite.value)
527-- forkIP(options.referenceSite.value) 527-- forkIP(options.referenceSite.value)
528 checkRedirects("deb.devuan.org") 528 checkHost("deb.devuan.org")
529-- forkIP("deb.devuan.org") 529-- forkIP("deb.devuan.org")
530 for k, m in pairs(mirrors) do 530 for k, m in pairs(mirrors) do
531 if "/" == m.BaseURL:sub(-1, -1) then 531 if "/" == m.BaseURL:sub(-1, -1) then
@@ -533,7 +533,7 @@ else
533 m.BaseURL = m.BaseURL:sub(1, -2) 533 m.BaseURL = m.BaseURL:sub(1, -2)
534 end 534 end
535 local pu = url.parse("http://" .. m.BaseURL) 535 local pu = url.parse("http://" .. m.BaseURL)
536 checkRedirects(m.BaseURL) 536 checkHost(m.BaseURL)
537-- forkIP(m.BaseURL) 537-- forkIP(m.BaseURL)
538 checkExes("mirror-checker.lua " .. sendArgs) 538 checkExes("mirror-checker.lua " .. sendArgs)
539 if testing("Integrity") or testing("Updated") then checkExes(downloadLock) end 539 if testing("Integrity") or testing("Updated") then checkExes(downloadLock) end