-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
base: main
Are you sure you want to change the base?
Conversation
Hey, thank you for opening your first Pull Request ! |
- Updated `http_download_curl` to log HTTP errors using `log_err` instead of `log_debug`. - Modified `http_download_wget` to check HTTP status codes, mirroring curl's behavior. - Return exit status 1 for non-200 responses in `http_download_wget`. - Standardized error logging across both download functions.
6b3e0fa
to
cdf68aa
Compare
wget
and curl
wget
and curl
if [ "$code" != "200" ]; then | ||
log_err "http_download_wget received HTTP status $code" | ||
return 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this doesn't work in all cases, and it can hide other errors.
$ wget --server-response --quiet -O foo http://example.g 2>&1 | awk '/^ HTTP/{print $2}' | tail -n1
$ echo $?
0
$ wget --server-response --quiet -O foo http://example.g
$ echo $?
4
$ wget --server-response -O foo http://example.g
--2025-07-28 23:19:59-- http://example.g/
Resolving example.g (example.g)... failed: Name or service not known.
wget: unable to resolve host address 'example.g'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, good catch. Will look into it soon enough. Thanks for the quick review!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in a8f43c2
Summary
This PR improves the error handling and consistency between
http_download_curl
andhttp_download_wget
ininstall.sh
.Changes
http_download_curl
to uselog_err
for non-200 HTTP status codes instead oflog_debug
.http_download_wget
to:wget --server-response
.1
for non-200 HTTP responses, matching the behavior ofhttp_download_curl
.log_err
for better visibility.http_download
to directly callhttp_download_wget
after its availability check.Why
Previously,
http_download_wget
did not validate HTTP response codes, which led to misleading behavior. For example, when GitHub returned an HTTP 503, the installer incorrectly reported that the requested version did not exist:In this case, the tag
v1.64.8
did exist, but the underlying issue was a GitHub service error returning a503
. By properly checking and logging HTTP response codes, this update makes such scenarios clearer to users and avoids misleading "version not found" messages.