@@ -473,6 +473,7 @@ downloader() {
473
473
local _ciphersuites
474
474
local _err
475
475
local _status
476
+ local _retry
476
477
if check_cmd curl; then
477
478
_dld=curl
478
479
elif check_cmd wget; then
@@ -484,10 +485,12 @@ downloader() {
484
485
if [ " $1 " = --check ]; then
485
486
need_cmd " $_dld "
486
487
elif [ " $_dld " = curl ]; then
488
+ check_curl_for_retry_support
489
+ _retry=" $RETVAL "
487
490
get_ciphersuites_for_curl
488
491
_ciphersuites=" $RETVAL "
489
492
if [ -n " $_ciphersuites " ]; then
490
- _err=$( curl --proto ' =https' --tlsv1.2 --ciphers " $_ciphersuites " --silent --show-error --fail --location " $1 " --output " $2 " 2>&1 )
493
+ _err=$( curl $_retry --proto ' =https' --tlsv1.2 --ciphers " $_ciphersuites " --silent --show-error --fail --location " $1 " --output " $2 " 2>&1 )
491
494
_status=$?
492
495
else
493
496
echo " Warning: Not enforcing strong cipher suites for TLS, this is potentially less secure"
@@ -589,8 +592,19 @@ check_help_for() {
589
592
true # not strictly needed
590
593
}
591
594
595
+ # Check if curl supports the --retry flag, then pass it to the curl invocation.
596
+ check_curl_for_retry_support () {
597
+ # "unspecified" is for arch, allows for possibility old OS using macports, homebrew, etc.
598
+ if check_help_for " notspecified" " curl" " --retry" ; then
599
+ local _retry_supported=" --retry 3"
600
+ fi
601
+
602
+ RETVAL=" $_retry_supported "
603
+
604
+ }
605
+
592
606
# Return cipher suite string specified by user, otherwise return strong TLS 1.2-1.3 cipher suites
593
- # if support by local tools is detected. Detection currently supports these curl backends:
607
+ # if support by local tools is detected. Detection currently supports these curl backends:
594
608
# GnuTLS and OpenSSL (possibly also LibreSSL and BoringSSL). Return value can be empty.
595
609
get_ciphersuites_for_curl () {
596
610
if [ -n " ${RUSTUP_TLS_CIPHERSUITES-} " ]; then
@@ -635,7 +649,7 @@ get_ciphersuites_for_curl() {
635
649
}
636
650
637
651
# Return cipher suite string specified by user, otherwise return strong TLS 1.2-1.3 cipher suites
638
- # if support by local tools is detected. Detection currently supports these wget backends:
652
+ # if support by local tools is detected. Detection currently supports these wget backends:
639
653
# GnuTLS and OpenSSL (possibly also LibreSSL and BoringSSL). Return value can be empty.
640
654
get_ciphersuites_for_wget () {
641
655
if [ -n " ${RUSTUP_TLS_CIPHERSUITES-} " ]; then
@@ -660,10 +674,10 @@ get_ciphersuites_for_wget() {
660
674
RETVAL=" $_cs "
661
675
}
662
676
663
- # Return strong TLS 1.2-1.3 cipher suites in OpenSSL or GnuTLS syntax. TLS 1.2
664
- # excludes non-ECDHE and non-AEAD cipher suites. DHE is excluded due to bad
677
+ # Return strong TLS 1.2-1.3 cipher suites in OpenSSL or GnuTLS syntax. TLS 1.2
678
+ # excludes non-ECDHE and non-AEAD cipher suites. DHE is excluded due to bad
665
679
# DH params often found on servers (see RFC 7919). Sequence matches or is
666
- # similar to Firefox 68 ESR with weak cipher suites disabled via about:config.
680
+ # similar to Firefox 68 ESR with weak cipher suites disabled via about:config.
667
681
# $1 must be openssl or gnutls.
668
682
get_strong_ciphersuites_for () {
669
683
if [ " $1 " = " openssl" ]; then
@@ -673,7 +687,7 @@ get_strong_ciphersuites_for() {
673
687
# GnuTLS isn't forgiving of unknown values, so this may require a GnuTLS version that supports TLS 1.3 even if wget doesn't.
674
688
# Begin with SECURE128 (and higher) then remove/add to build cipher suites. Produces same 9 cipher suites as OpenSSL but in slightly different order.
675
689
echo " SECURE128:-VERS-SSL3.0:-VERS-TLS1.0:-VERS-TLS1.1:-VERS-DTLS-ALL:-CIPHER-ALL:-MAC-ALL:-KX-ALL:+AEAD:+ECDHE-ECDSA:+ECDHE-RSA:+AES-128-GCM:+CHACHA20-POLY1305:+AES-256-GCM"
676
- fi
690
+ fi
677
691
}
678
692
679
693
main " $@ " || exit 1
0 commit comments