Skip to content

dev: improve HTTP download error handling for wget and curl #5962

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 9, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ http_download_curl() {
code=$(curl -w '%{http_code}' -sL -H "$header" -o "$local_file" "$source_url")
fi
if [ "$code" != "200" ]; then
log_debug "http_download_curl received HTTP status $code"
log_err "http_download_curl received HTTP status $code"
return 1
fi
return 0
Expand All @@ -311,10 +311,15 @@ http_download_wget() {
source_url=$2
header=$3
if [ -z "$header" ]; then
wget -q -O "$local_file" "$source_url"
code=$(wget --server-response --quiet -O "$local_file" "$source_url" 2>&1 | awk '/^ HTTP/{print $2}' | tail -n1)
else
wget -q --header "$header" -O "$local_file" "$source_url"
code=$(wget --server-response --quiet --header "$header" -O "$local_file" "$source_url" 2>&1 | awk '/^ HTTP/{print $2}' | tail -n1)
fi
if [ "$code" != "200" ]; then
log_err "http_download_wget received HTTP status $code"
return 1
fi
return 0
}
http_download() {
log_debug "http_download $2"
Expand Down