mirror of
https://github.com/pyenv/pyenv.git
synced 2025-11-08 19:43:48 -05:00
Use aria2c as the download if available (#534)
This commit is contained in:
@@ -323,7 +323,9 @@ http() {
|
||||
local file="$3"
|
||||
[ -n "$url" ] || return 1
|
||||
|
||||
if type curl &>/dev/null; then
|
||||
if type aria2c &>/dev/null; then
|
||||
"http_${method}_aria2c" "$url" "$file"
|
||||
elif type curl &>/dev/null; then
|
||||
"http_${method}_curl" "$url" "$file"
|
||||
elif type wget &>/dev/null; then
|
||||
"http_${method}_wget" "$url" "$file"
|
||||
@@ -333,6 +335,20 @@ http() {
|
||||
fi
|
||||
}
|
||||
|
||||
http_head_aria2c() {
|
||||
options=""
|
||||
[ -n "${IPV4}" ] && options="--disable-ipv6=true"
|
||||
[ -n "${IPV6}" ] && options="--disable-ipv6=false"
|
||||
aria2c -q --dry-run ${options} "$1" >&4 2>&1
|
||||
}
|
||||
|
||||
http_get_aria2c() {
|
||||
options=""
|
||||
[ -n "${IPV4}" ] && options="--disable-ipv6=true"
|
||||
[ -n "${IPV6}" ] && options="--disable-ipv6=false"
|
||||
aria2c -q -o "${2:--}" ${options} "$1"
|
||||
}
|
||||
|
||||
http_head_curl() {
|
||||
options=""
|
||||
[ -n "${IPV4}" ] && options="--ipv4"
|
||||
|
||||
Reference in New Issue
Block a user