Skip to content

Honor HTTP proxy environment variables in package downloads#9985

Open
Rehan30g wants to merge 1 commit into
roc-lang:mainfrom
Rehan30g:fix/package-download-proxy-env
Open

Honor HTTP proxy environment variables in package downloads#9985
Rehan30g wants to merge 1 commit into
roc-lang:mainfrom
Rehan30g:fix/package-download-proxy-env

Conversation

@Rehan30g

@Rehan30g Rehan30g commented Jul 6, 2026

Copy link
Copy Markdown

Fixes #9895

Problem

The package downloader creates a std.http.Client with no proxy configuration, so it always makes direct connections. In network-restricted environments (sandboxes, corporate networks) where git clone works through HTTPS_PROXY, roc check/build/test still 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) via std.http.Client.initDefaultProxies, so proxy URL parsing and CONNECT tunneling reuse the std implementation — the same behavior as zig fetch. Env access uses std.c.getenv, the existing pattern in this codebase (e.g. CoreCtx.osGetEnvVar).

A malformed proxy URL now fails explicitly with a new error.InvalidProxyUrl rather than being silently ignored.

Verification

Built with zig build roc and 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.rocconnect(..., 127.0.0.1:3128) — the download goes through the proxy.
  • Without proxy env vars → direct connect(..., <target>:443) — default behavior unchanged.

zig fmt --check passes on the changed file.

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support HTTP proxy environment variables in package downloads

1 participant