diff options
-rwxr-xr-x | apt-panopticon.lua | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/apt-panopticon.lua b/apt-panopticon.lua index 84a6bed..e1a481f 100755 --- a/apt-panopticon.lua +++ b/apt-panopticon.lua | |||
@@ -151,19 +151,26 @@ local results = {} | |||
151 | local log = function(v, t, s, prot, test, host) | 151 | local log = function(v, t, s, prot, test, host) |
152 | local x = "" | 152 | local x = "" |
153 | if nil == prot then prot = "" end | 153 | if nil == prot then prot = "" end |
154 | if nil ~= test then x = x .. test else test = "" end | 154 | if nil == test then test = "" end |
155 | x = x .. prot | ||
156 | if "" ~= test then | ||
157 | if #x > 0 then x = x .. " " end | ||
158 | x = x .. test | ||
159 | end | ||
155 | if nil ~= host then | 160 | if nil ~= host then |
156 | if #x > 0 then x = x .. " " end | 161 | if #x > 0 then x = x .. " " end |
157 | x = x .. host | 162 | x = x .. host |
158 | end | 163 | end |
159 | if #x > 0 then | 164 | if #x > 0 then |
160 | t = t .. "(" .. x .. ")" | 165 | t = t .. "(" .. x .. ")" |
161 | if "" == test then | 166 | if "" ~= prot then |
162 | if v == 0 then results[prot].errors = results[prot].errors + 1 end | 167 | if "" == test then |
163 | if v == 1 then results[prot].warnings = results[prot].warnings + 1 end | 168 | if v == 0 then results[prot].errors = results[prot].errors + 1 end |
164 | else | 169 | if v == 1 then results[prot].warnings = results[prot].warnings + 1 end |
165 | if v == 0 then results[prot][test].errors = results[prot][test].errors + 1 end | 170 | else |
166 | if v == 1 then results[prot][test].warnings = results[prot][test].warnings + 1 end | 171 | if v == 0 then results[prot][test].errors = results[prot][test].errors + 1 end |
172 | if v == 1 then results[prot][test].warnings = results[prot][test].warnings + 1 end | ||
173 | end | ||
167 | end | 174 | end |
168 | end | 175 | end |
169 | if v <= verbosity then | 176 | if v <= verbosity then |
@@ -304,7 +311,7 @@ checkHEAD = function (host, URL, r, retry) | |||
304 | end | 311 | end |
305 | 312 | ||
306 | if l == URL then | 313 | if l == URL then |
307 | E(" redirect loop! " .. check .. " " .. host .. " -> " .. URL, PU.scheme, PU.scheme, host) | 314 | E(" redirect loop! " .. check .. " " .. host .. " -> " .. URL, PU.scheme, "", host) |
308 | elseif nil == pu.host then | 315 | elseif nil == pu.host then |
309 | I(" relative redirect. " .. check .. " " .. host .. " -> " .. URL .. " -> " .. l) | 316 | I(" relative redirect. " .. check .. " " .. host .. " -> " .. URL .. " -> " .. l) |
310 | checkHEAD(host, PU.scheme .. "://" .. PU.host .. l, r + 1) | 317 | checkHEAD(host, PU.scheme .. "://" .. PU.host .. l, r + 1) |
@@ -459,7 +466,7 @@ local getMirrors = function () | |||
459 | end | 466 | end |
460 | m[t] = prot | 467 | m[t] = prot |
461 | elseif "Active" == t and nil == d:find("yes", 1, true) then | 468 | elseif "Active" == t and nil == d:find("yes", 1, true) then |
462 | W("Mirror " .. host .. " is not active - " .. d) | 469 | W("Mirror " .. host .. " is not active - " .. d, "", "", host) |
463 | active = false | 470 | active = false |
464 | -- TODO - Should do some input validation on BaseURL, and everything else. | 471 | -- TODO - Should do some input validation on BaseURL, and everything else. |
465 | else | 472 | else |
@@ -627,11 +634,11 @@ else | |||
627 | checkHost(options.referenceSite.value) | 634 | checkHost(options.referenceSite.value) |
628 | for k, m in pairs(mirrors) do | 635 | for k, m in pairs(mirrors) do |
629 | if "/" == m.BaseURL:sub(-1, -1) then | 636 | if "/" == m.BaseURL:sub(-1, -1) then |
630 | W("slash at end of BaseURL in mirror_list.txt! " .. m.BaseURL) | 637 | W("slash at end of BaseURL in mirror_list.txt! " .. m.BaseURL, "", "", m.FQDN) |
631 | m.BaseURL = m.BaseURL:sub(1, -2) | 638 | m.BaseURL = m.BaseURL:sub(1, -2) |
632 | end | 639 | end |
633 | if " " == m.BaseURL:sub(-1, -1) then | 640 | if " " == m.BaseURL:sub(-1, -1) then |
634 | W("space at end of BaseURL in mirror_list.txt! " .. m.BaseURL) | 641 | W("space at end of BaseURL in mirror_list.txt! " .. m.BaseURL, "", "", m.FQDN) |
635 | m.BaseURL = m.BaseURL:sub(1, -2) | 642 | m.BaseURL = m.BaseURL:sub(1, -2) |
636 | end | 643 | end |
637 | local pu = url.parse("http://" .. m.BaseURL) | 644 | local pu = url.parse("http://" .. m.BaseURL) |