From a135d7d1385809d377e9a44b53d608f18dbbd76f Mon Sep 17 00:00:00 2001 From: onefang Date: Wed, 26 Jun 2019 14:43:26 +1000 Subject: Move the check for a slash at the end of the BaseURL. --- mirror-checker.lua | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/mirror-checker.lua b/mirror-checker.lua index 86528f3..bba9d49 100755 --- a/mirror-checker.lua +++ b/mirror-checker.lua @@ -266,12 +266,6 @@ end local checkHost = function (host, path, ip) if nil == path then path = "/" else - if "/" == path:sub(-1, -1) then - W("slash at end of BaseURL in mirror_list.txt! " .. host .. " " .. path) - else - path = path .. "/" - end - end checkIP(host, host, path, ip) end @@ -396,6 +390,10 @@ end execute("mkdir -p results") if 0 < #arg then + if "/" == arg[1]:sub(-1, -1) then + W("slash at end of path! " .. arg[1]) + arg[1] = arg[1]:sub(1, -2) + end local pu = url.parse("http://" .. arg[1], defaultURL) if nil ~= arg[2] then logFile, e = io.open("results/mirror-checker-lua_" .. pu.host .. "_" .. arg[2] .. ".log", "a+") @@ -426,6 +424,10 @@ else -- checkHost("deb.devuan.org") forkIP("deb.devuan.org") for k, m in pairs(mirrors) do + if "/" == m.BaseURL:sub(-1, -1) then + W("slash at end of BaseURL in mirror_list.txt! " .. m.BaseURL) + m.BaseURL = m.BaseURL:sub(1, -2) + end local pu = url.parse("http://" .. m.BaseURL, defaultURL) -- checkHost(pu.host) forkIP(m.BaseURL) -- cgit v1.1