aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xmodules/mga-mirrors/files/check_mirrors_status22
1 files changed, 18 insertions, 4 deletions
diff --git a/modules/mga-mirrors/files/check_mirrors_status b/modules/mga-mirrors/files/check_mirrors_status
index b31d4da5..c3d41354 100755
--- a/modules/mga-mirrors/files/check_mirrors_status
+++ b/modules/mga-mirrors/files/check_mirrors_status
@@ -33,18 +33,32 @@ def get_mirrors
# TODO Get it from the DB
mirrors = []
url = nil
+ tier1 = false
fetch_url("http://mirrors.mageia.org/").each_line{|l|
if l =~ /rsync.mageia.org/ then
- mirrors.prepend url unless url.nil?
+ tier1 = true
+ next
+ end
+ if l=~ /<\/tr>/ && !url.nil? then
+ if tier1 then
+ mirrors.prepend
+ tier1 = false
+ else
+ mirrors.append url
+ end
url = nil
next
end
- next unless l =~ /http:.*>http/
- mirrors.append url unless url.nil?
+ next unless l =~ /https?:.*>http/
+ # No need to check twice mirrors available in http + https
+ if !url.nil? && url =~ /https:/ && l =~ /https:\/\//
+ # Skip http:// if https:// already seen for current mirror
+ # If the are in the other order http one will just be replaced
+ next
+ end
url = l.sub(/<a href="(http[^"]*)".*\n/, '\1')
url += "/" unless url =~ /\/$/
}
- mirrors.append url unless url.nil?
mirrors
end