[PATCH] [rankmirrors] Follow redirects
Signed-off-by: Matthieu Rakotojaona <matthieu.rakotojaona@gmail.com> --- As initially discussed in https://bbs.archlinux.org/viewtopic.php?id=254562, rankmirrors by default doesn't follow redirects, so when curl returns a 301 it assumes it's not a 4xx and so the mirror is considered valid. However if the 301 works but the actual mirror fails, such as for http://archlinux.vi-di.fr/core/os/x86_84, the mirror is still marked as valid src/rankmirrors.sh.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rankmirrors.sh.in b/src/rankmirrors.sh.in index c2f564b..a8de15c 100644 --- a/src/rankmirrors.sh.in +++ b/src/rankmirrors.sh.in @@ -62,7 +62,7 @@ err() { # gettime fetchurl (e.g gettime http://foo.com/core/os/i686/core.db.tar.gz) # returns the fetching time, or timeout, or unreachable gettime() { - IFS=' ' output=( $(curl -s -m $MAX_TIME -w "%{time_total} %{http_code}" "$1" -o/dev/null) ) + IFS=' ' output=( $(curl -L -s -m $MAX_TIME -w "%{time_total} %{http_code}" "$1" -o/dev/null) ) (( $? == 28 )) && echo timeout && return (( ${output[1]} >= 400 || ! ${output[1]} )) && echo unreachable && return echo "${output[0]}" -- 2.26.0
participants (1)
-
Matthieu Rakotojaona