From be770de9587fd80a8f303638133edf6dd78de163 Mon Sep 17 00:00:00 2001 From: LEAN-ESX Date: Mon, 11 Nov 2019 19:58:10 -0800 Subject: [PATCH] download.pl: add jsDelivr mirror for GitHub --- scripts/download.pl | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/scripts/download.pl b/scripts/download.pl index 2591d0fc4..017e952b2 100755 --- a/scripts/download.pl +++ b/scripts/download.pl @@ -203,9 +203,13 @@ foreach my $mirror (@ARGV) { push @mirrors, "ftp://apache.cs.utah.edu/apache.org/$1"; push @mirrors, "ftp://apache.mirrors.ovh.net/ftp.apache.org/dist/$1"; } elsif ($mirror =~ /^\@GITHUB\/(.+)$/) { + my $dir = $1; + my $i = 0; + # replace the 2nd '/' with '@' for jsDelivr mirror + push @mirrors, "https://cdn.jsdelivr.net/gh/". $dir =~ s{\/}{++$i == 2 ? '@' : $&}ger; # give github a few more tries (different mirrors) for (1 .. 5) { - push @mirrors, "https://raw.githubusercontent.com/$1"; + push @mirrors, "https://raw.githubusercontent.com/$dir"; } } elsif ($mirror =~ /^\@GNU\/(.+)$/) { push @mirrors, "https://mirror.csclub.uwaterloo.ca/gnu/$1";