common: honor HTTP_PROXY/HTTPS_PROXY env vars in http client#21752
Open
texasich wants to merge 1 commit intoggml-org:masterfrom
Open
common: honor HTTP_PROXY/HTTPS_PROXY env vars in http client#21752texasich wants to merge 1 commit intoggml-org:masterfrom
texasich wants to merge 1 commit intoggml-org:masterfrom
Conversation
common_http_client() was ignoring standard proxy env vars, causing downloads via -hf and similar flags to fail silently in environments behind an HTTP proxy (corporate networks, air-gapped infra, etc.). Checks HTTPS_PROXY/https_proxy for https:// URLs and HTTP_PROXY/http_proxy for http:// URLs, in that order. If a proxy URL is set and parseable, passes it to httplib's set_proxy() and set_proxy_basic_auth() as appropriate. Malformed proxy URLs are silently ignored so existing callers aren't affected. Fixes ggml-org#21694
|
Hi @texasich, thanks for your contribution! Per our contribution guidelines, the automated PR checker found the following issue(s) that need your attention:
Please note that maintainers reserve the right to make final decisions on PRs. If you believe there is a mistake, please comment below. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #21694
What
common_http_client()builds the httplib client but never checks standard proxy environment variables, so any download that goes through this path (e.g.-hfflag, model presets) silently fails in environments that require a proxy.How
After constructing the client, read
HTTPS_PROXY/https_proxyforhttps://URLs andHTTP_PROXY/http_proxyforhttp://ones (scheme-specific takes precedence). If set and parseable, pass it tocli.set_proxy()and optionallycli.set_proxy_basic_auth(). Malformed proxy URLs are caught and silently ignored so nothing breaks for callers without a proxy configured.Reuses the existing
common_http_parse_url()to handle auth credentials embedded in the proxy URL (e.g.http://user:pass@proxy:3128).Notes
NO_PROXY/no_proxybypass list not implemented yet; can be added as follow-upALL_PROXYnot checked; HTTPS_PROXY and HTTP_PROXY cover the common casestd::getenvis available via<cstdlib>already pulled in by httplib.h