From fe4bec0bd4bf8d801911a5c476aa6a07c97dba48 Mon Sep 17 00:00:00 2001 From: darkyshiny Date: Wed, 26 Oct 2022 21:09:34 +0200 Subject: [PATCH] Add automatic resume flag when retrying download with curl --- rustup-init.sh | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/rustup-init.sh b/rustup-init.sh index fc19b2d6fa..e1e5d1237a 100755 --- a/rustup-init.sh +++ b/rustup-init.sh @@ -607,14 +607,17 @@ check_help_for() { # Check if curl supports the --retry flag, then pass it to the curl invocation. check_curl_for_retry_support() { - local _retry_supported="" - # "unspecified" is for arch, allows for possibility old OS using macports, homebrew, etc. - if check_help_for "notspecified" "curl" "--retry"; then - _retry_supported="--retry 3" - fi - - RETVAL="$_retry_supported" + local _retry_supported="" + # "unspecified" is for arch, allows for possibility old OS using macports, homebrew, etc. + if check_help_for "notspecified" "curl" "--retry"; then + _retry_supported="--retry 3" + if check_help_for "notspecified" "curl" "--continue-at"; then + # "-C -" tells curl to automatically find where to resume the download when retrying. + _retry_supported="--retry 3 -C -" + fi + fi + RETVAL="$_retry_supported" } # Return cipher suite string specified by user, otherwise return strong TLS 1.2-1.3 cipher suites