From 69147cdcf7463249f62c0486a4db5720217e0768 Mon Sep 17 00:00:00 2001 From: Pascal Terjan Date: Thu, 25 Feb 2021 22:45:56 +0000 Subject: Also check https only mirrors The ones available both on http and https will be checked as https --- modules/mga-mirrors/files/check_mirrors_status | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) (limited to 'modules/mga-mirrors/files/check_mirrors_status') 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(/