aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authoronefang2019-06-28 15:38:04 +1000
committeronefang2019-06-28 15:38:04 +1000
commit3b58f79240410ac1603ab6eb2a94bff1b62d1409 (patch)
treece2d3c6c0b988d67259f883a30d5c4cd34372a22
parentMerge checkHost() and forkIP() into checkRedirect() (diff)
downloadapt-panopticon-3b58f79240410ac1603ab6eb2a94bff1b62d1409.zip
apt-panopticon-3b58f79240410ac1603ab6eb2a94bff1b62d1409.tar.gz
apt-panopticon-3b58f79240410ac1603ab6eb2a94bff1b62d1409.tar.bz2
apt-panopticon-3b58f79240410ac1603ab6eb2a94bff1b62d1409.tar.xz
Line up some of the messages better.
-rwxr-xr-xmirror-checker.lua16
1 files changed, 8 insertions, 8 deletions
diff --git a/mirror-checker.lua b/mirror-checker.lua
index aada1e2..4a82309 100755
--- a/mirror-checker.lua
+++ b/mirror-checker.lua
@@ -193,34 +193,34 @@ checkURL = function (host, URL, r, retry)
193 return 193 return
194 end 194 end
195 local PU = url.parse(URL, defaultURL) 195 local PU = url.parse(URL, defaultURL)
196 D(" " .. PU.scheme .. " :// " .. check .. " " .. host .. " -> " .. URL) 196 D(PU.scheme .. " :// " .. check .. " " .. host .. " -> " .. URL)
197 if not testing(PU.scheme) then D("not testing " .. PU.scheme .. " " .. host .. " -> " .. URL); return end 197 if not testing(PU.scheme) then D("not testing " .. PU.scheme .. " " .. host .. " -> " .. URL); return end
198 local hd = {Host = host} 198 local hd = {Host = host}
199 local p, c, h, s = http.request{method = "HEAD", redirect = false, url = URL, headers = hd} 199 local p, c, h, s = http.request{method = "HEAD", redirect = false, url = URL, headers = hd}
200 if nil == s then s = "" end 200 if nil == s then s = "" end
201 if nil == p then 201 if nil == p then
202 E(c .. " " .. s .. "! " .. check .. " " .. host .. " -> " .. URL) 202 E(" " .. c .. " " .. s .. "! " .. check .. " " .. host .. " -> " .. URL)
203 -- So far the only errors are "timeout", "Network is unreachable", and "closed", and I suspect "closed" is due to saturating my bandwidth. 203 -- So far the only errors are "timeout", "Network is unreachable", and "closed", and I suspect "closed" is due to saturating my bandwidth.
204 -- Might be worthwhile retrying those, some number of times. 204 -- Might be worthwhile retrying those, some number of times.
205 if ("closed" == c) or ("Network is unreachable" == c) or ("timeout" == c) then checkURL(host, URL, r, retry + 1) end 205 if ("closed" == c) or ("Network is unreachable" == c) or ("timeout" == c) then checkURL(host, URL, r, retry + 1) end
206 else 206 else
207 if ("4" == tostring(c):sub(1, 1)) or ("5" == tostring(c):sub(1, 1)) then 207 if ("4" == tostring(c):sub(1, 1)) or ("5" == tostring(c):sub(1, 1)) then
208 E(c .. " " .. s .. ". " .. check .. " " .. host .. " -> " .. URL) 208 E(" " .. c .. " " .. s .. ". " .. check .. " " .. host .. " -> " .. URL)
209 else 209 else
210 I(c .. " " .. s .. ". " .. check .. " " .. host .. " -> " .. URL) 210 I(" " .. c .. " " .. s .. ". " .. check .. " " .. host .. " -> " .. URL)
211 end 211 end
212 l = h.location 212 l = h.location
213 if nil ~= l then 213 if nil ~= l then
214 local pu = url.parse(l, defaultURL) 214 local pu = url.parse(l, defaultURL)
215 if l == URL then 215 if l == URL then
216 E("redirect loop! " .. check .. " " .. host .. " -> " .. URL) 216 E(" redirect loop! " .. check .. " " .. host .. " -> " .. URL)
217 else 217 else
218 if nil == pu.host then 218 if nil == pu.host then
219 W("no location host! " .. check .. " " .. host .. " -> " .. URL .. " -> " .. l) 219 W(" no location host! " .. check .. " " .. host .. " -> " .. URL .. " -> " .. l)
220 checkURL(host, PU.scheme .. "://" .. PU.host .. l, r + 1) 220 checkURL(host, PU.scheme .. "://" .. PU.host .. l, r + 1)
221 else 221 else
222 if testing("Protocol") and pu.scheme ~= PU.scheme then 222 if testing("Protocol") and pu.scheme ~= PU.scheme then
223 W("protocol changed during redirect! " .. check .. " " .. host .. " -> " .. URL .. " -> " .. l) 223 W(" protocol changed during redirect! " .. check .. " " .. host .. " -> " .. URL .. " -> " .. l)
224 end 224 end
225 checkURL(pu.host, l, r + 1, retry) 225 checkURL(pu.host, l, r + 1, retry)
226 end 226 end
@@ -247,7 +247,7 @@ local checkPaths = function (host, ip, path)
247end 247end
248 248
249local execute = function (s) 249local execute = function (s)
250 D("executing " .. s) 250 D(" executing " .. s)
251 os.execute(s) 251 os.execute(s)
252end 252end
253 253