@@ -453,20 +453,34 @@ check_help_for() {
453453}
454454
455455# Check if curl supports the --retry flag, then pass it to the curl invocation.
456+ # Note that --speed-limit and --speed-time were in the very first commit of curl.
457+ # So this should be pretty much ubiquitously safe.
456458check_curl_for_retry_support () {
457- local _retry_supported=" "
458- # "unspecified" is for arch, allows for possibility old OS using macports, homebrew, etc.
459- if check_help_for " notspecified" " curl" " --retry" ; then
460- _retry_supported=" --retry 3"
461- if check_help_for " notspecified" " curl" " --continue-at" ; then
462- # "-C -" tells curl to automatically find where to resume the download when retrying.
463- _retry_supported=" --retry 3 -C -"
464- fi
465- fi
466-
467- RETVAL=" $_retry_supported "
459+ local _retry_part=" "
460+ local _continue_part=" "
461+ local _speed_limit_part=" "
462+
463+ # "unspecified" is for arch, allows for possibility old OS using macports, homebrew, etc.
464+ if check_help_for " notspecified" " curl" " --retry" ; then
465+ _retry_supported=" --retry 3"
466+
467+ if check_help_for " notspecified" " curl" " --continue-at" ; then
468+ # "-C -" tells curl to automatically find where to resume the download when retrying.
469+ _continue_part=" --continue-at -"
470+ fi
471+
472+ if check_help_for " notspecified" " curl" " --speed-limit" \
473+ && check_help_for " notspecified" " curl" " --speed-time" ; then
474+ # 250000 is approximately 20% of the bandwidth of typical DSL
475+ # these limits mean users below these limits will see failures.
476+ _speed_limit_part=" --speed-limit 250000 --speed-time 15"
477+ fi
478+ fi
479+
480+ RETVAL=" $_retry_part $_continue_part $_speed_limit_part "
468481}
469482
483+
470484# Return cipher suite string specified by user, otherwise return strong TLS 1.2-1.3 cipher suites
471485# if support by local tools is detected. Detection currently supports these curl backends:
472486# GnuTLS and OpenSSL (possibly also LibreSSL and BoringSSL). Return value can be empty.
0 commit comments