Honor HTTP proxy environment variables in package downloads#9985
Open
Rehan30g wants to merge 1 commit into
Open
Honor HTTP proxy environment variables in package downloads#9985Rehan30g wants to merge 1 commit into
Rehan30g wants to merge 1 commit into
Conversation
The package downloader's std.http.Client made direct connections only, so roc check/build/test failed to download URL packages in environments where traffic must go through a proxy (e.g. sandboxes where git works via HTTPS_PROXY but roc's downloads do not). Configure the client from the standard proxy environment variables (http_proxy/HTTP_PROXY, https_proxy/HTTPS_PROXY, all_proxy/ALL_PROXY) using std.http.Client.initDefaultProxies, matching zig fetch behavior. Fixes roc-lang#9895
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 #9895
Problem
The package downloader creates a
std.http.Clientwith no proxy configuration, so it always makes direct connections. In network-restricted environments (sandboxes, corporate networks) wheregit cloneworks throughHTTPS_PROXY,roc check/build/teststill fail to download URL packages.Change
Configure the client from the standard proxy environment variables (
http_proxy/HTTP_PROXY,https_proxy/HTTPS_PROXY,all_proxy/ALL_PROXY) viastd.http.Client.initDefaultProxies, so proxy URL parsing and CONNECT tunneling reuse the std implementation — the same behavior aszig fetch. Env access usesstd.c.getenv, the existing pattern in this codebase (e.g.CoreCtx.osGetEnvVar).A malformed proxy URL now fails explicitly with a new
error.InvalidProxyUrlrather than being silently ignored.Verification
Built with
zig build rocand traced syscalls against an app whose platform URL points at a (valid-hash) https URL:HTTPS_PROXY=http://127.0.0.1:3128 roc check main.roc→connect(..., 127.0.0.1:3128)— the download goes through the proxy.connect(..., <target>:443)— default behavior unchanged.zig fmt --checkpasses on the changed file.