Honor HTTP/HTTPS proxy env vars in Hub (#53)#57
Merged
Conversation
LlamaCppEx.Hub uses Req -> Finch -> Mint, which (unlike curl/wget) does not read proxy environment variables. On proxy-only networks every HuggingFace request went direct and timed out.
Add proxy_request_options/2, resolving a proxy from the :proxy option (URL string, Mint {scheme, host, port, opts} tuple, or false) or the standard env vars: HTTPS_PROXY/HTTP_PROXY (and lowercase) take precedence over ALL_PROXY, with NO_PROXY/:no_proxy host bypass. Supports basic-auth userinfo (redacted in logs). Wired into search, list_gguf_files, get_model_info, and the streaming download.
SOCKS proxies are detected and skipped with an actionable warning, since Mint supports HTTP/1 CONNECT proxies only; documented in a new Proxies moduledoc section with the Privoxy/gost bridge workaround.
Adds 20 TDD unit tests in test/hub_proxy_test.exs.
nyo16
added a commit
that referenced
this pull request
Jun 16, 2026
Update the vendor/llama.cpp submodule from 597b6672e (b9621) to 74ade5274 (b9672), 51 commits. No NIF changes required: every header the binding compiles against (include/llama.h, ggml.h, ggml-backend.h, common/chat.h, speculative.h, json-schema-to-grammar.h, sampling.h, common.h) is unchanged. Verified end-to-end against the freshly built NIF: 158 tests + 7 smoke tests pass (generation, streaming, chat templates, JSON-schema grammar, raw GBNF, embeddings), formatting clean, Dialyzer 0 errors. Also backfill the missing v0.8.25 CHANGELOG entry (Hub HTTP/HTTPS proxy support, #57), which shipped as a tag without a changelog/version bump, and advance @Version 0.8.24 -> 0.8.26 accordingly.
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.
Closes #53
Problem
LlamaCppEx.Hubmakes its HuggingFace requests throughReq→Finch→Mint.Unlike
curl/wget/requests/Go, Mint does not read proxy environmentvariables. On a proxy-only network every request goes direct and times out:
Fix
Add a
proxy_request_options/2resolver that builds Mintconnect_optionsandwire it into all four
Req.getcall sites (search,list_gguf_files,get_model_info, and the streaming download).A proxy is resolved from, in order:
:proxyoption — a URL string, a Mint{scheme, address, port, opts}tuple, or
falseto disable.HTTPS_PROXY/HTTP_PROXY(and theirlowercase forms) take precedence over
ALL_PROXY, so a usable HTTP proxyalways wins over an unusable SOCKS one.
Other behavior:
NO_PROXY/:no_proxyhost bypass — exact,.suffix, and*.user:pass@userinfo →proxy-authorizationheader(credentials redacted in logs).
HTTPS_PROXYvalue applies and tunnels viathe
CONNECTmethod.SOCKS is not supported (by design)
The underlying stack (Req → Finch → Mint) supports HTTP/1 proxies only —
plain forwarding and HTTPS-over-
CONNECT. There is no SOCKS support anywhere inMint/Finch, so a
socks5://value (e.g. fromALL_PROXY) is detected andskipped with an actionable warning. To use a SOCKS upstream, run a local
HTTP-to-SOCKS bridge (Privoxy, gost) and point
HTTPS_PROXYat it. This isdocumented in a new "Proxies" section in the module doc.
Tests
test/hub_proxy_test.exs(env detection, precedence,NO_PROXY, basic-auth, SOCKS skip, default ports, scheme-less URLs).mix compile --warnings-as-errorsandmix format --check-formattedclean.