refactor: web_get() downloads with curl with fallback to wget on failure
This commit is contained in:
parent
9e99b08a8c
commit
5396e86eec
9
quickget
9
quickget
|
@ -1489,13 +1489,11 @@ function web_get() {
|
|||
echo "- URL: ${URL}"
|
||||
fi
|
||||
|
||||
if command -v curl &>/dev/null; then
|
||||
if ! curl --progress-bar --location --output "${DIR}/${FILE}" --continue-at - --user-agent "${USER_AGENT}" "${HEADERS[@]}" -- "${URL}"; then
|
||||
echo "ERROR! Failed to download ${URL} with curl."
|
||||
echo " Try deleting '${DIR}/${FILE}' running 'quickget' again."
|
||||
exit 1
|
||||
fi
|
||||
elif command -v wget2 &>/dev/null; then
|
||||
echo " Will try again with wget."
|
||||
rm -f "${DIR}/${FILE}"
|
||||
if command -v wget2 &>/dev/null; then
|
||||
if ! wget2 --quiet --continue --tries=3 --read-timeout=10 --force-progress --progress=bar:force:noscroll "${URL}" -O "${DIR}/${FILE}" "${HEADERS[@]}"; then
|
||||
echo "ERROR! Failed to download ${URL} with wget2."
|
||||
echo " Try deleting '${DIR}/${FILE}' running 'quickget' again."
|
||||
|
@ -1506,6 +1504,7 @@ function web_get() {
|
|||
echo " Try deleting '${DIR}/${FILE}' running 'quickget' again."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# checks if a URL needs to be redirected and returns the final URL
|
||||
|
|
Loading…
Reference in New Issue