From 75c0a7bb7a2694405bba5f7a1f8ae7f51177f8f2 Mon Sep 17 00:00:00 2001 From: onefang Date: Mon, 30 Sep 2019 21:51:45 +1000 Subject: Oops, should have been part of te last commit. --- mirror-checker.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mirror-checker.lua b/mirror-checker.lua index e3c6120..074064c 100755 --- a/mirror-checker.lua +++ b/mirror-checker.lua @@ -217,11 +217,13 @@ checkHEAD = function (host, URL, r, retry) return end local PU = url.parse(URL, defaultURL) + local pu = url.parse(PU.scheme .. "://" .. host, defaultURL) D(PU.scheme .. " :// " .. check .. " " .. host .. " -> " .. URL) if not testing(PU.scheme, host) then D("Not testing " .. PU.scheme .. " " .. host .. " -> " .. URL); return end -- TODO - Perhaps we should try it anyway, and mark it as a warning if it DOES work? if "https" == PU.scheme and "deb.devuan.org" == host then D("Not testing " .. PU.scheme .. " " .. host .. " -> " .. URL .. " mirrors shouldn't have the correct cert."); return end - local hd = {Host = host} + local hd = {} + if pu.host ~= PU.host then hd = {Host = host} end local htp = http; if PU.scheme == "https" then htp = https end -- NOTE - the docs for lua-sec say that redirect isn't supported is version 0.6, no idea if that means it ignores redirections like we want. @@ -242,7 +244,6 @@ checkHEAD = function (host, URL, r, retry) end l = h.location if nil ~= l then - local pu = url.parse(l, defaultURL) if testing("Protocol") and (pu.scheme ~= PU.scheme) then W(" protocol changed during redirect! " .. check .. " " .. host .. " -> " .. URL .. " -> " .. l) end -- cgit v1.1