Skip to content

add a proxy() setter with credential support - #210

Merged
jaemk merged 1 commit into
masterfrom
260901.corp3-proxy
Sep 2, 2026
Merged

jaemk merged 1 commit into
masterfrom
260901.corp3-proxy

Conversation

@jaemk

@jaemk jaemk commented Sep 1, 2026

Copy link
Copy Markdown
Owner

Adds proxy(url) on every Update / ReleaseList builder and on Download, for the authenticated
proxy case HTTP_PROXY / HTTPS_PROXY cannot cover. Completes CORP-3 in
specs/corporate-network-config.md.

  • Add proxy(url) to request_config_setters! and to Download. Credentials may be embedded in
    the URL (http://user:pass@proxy.corp:8080) and are sent as Proxy-Authorization. HTTP CONNECT
    only.
  • Collapse the cert-only client builders into a single ClientConfig { certs, proxy } feeding
    build_configured_client / build_configured_async_client, so add_root_certificate and
    proxy are applied to the same crate-built client and either one alone triggers the build. An
    injected client still wins, per slot.
  • Add Error::InvalidProxy { source }, deferred from the infallible setter to build() /
    download_to like the header and certificate errors. check() precedence is header, then
    certificate, then proxy; a generic build failure with no certificates configured is reported as
    a proxy failure rather than blaming a certificate the caller never set.
  • Redact the proxy password from the error text (including the wrapped client error, which may
    quote the URL) and from the hand-written Debug of RequestConfig and Download.
  • Forward the proxy to the download in build_download, so the release listing and the asset
    fetch take the same route.
  • reqwest applies the proxy alongside the env vars (first match wins); ureq has a single proxy
    slot, so the configured proxy replaces the env-var one.

Tests drive a real download through a loopback proxy stub at an unresolvable .invalid target
host, covering both reqwest's absolute-form GET and ureq's CONNECT tunnel, plus unit coverage for
the error attribution, the redaction, the Download forwarding, and the builder surface.

make ci is green.

`proxy(url)` on every `Update` / `ReleaseList` builder and on `Download` routes the
release listing and the asset download through an HTTP proxy. Credentials may be embedded
in the URL (`http://user:pass@proxy.corp:8080`) and are sent as `Proxy-Authorization`,
which the `HTTP_PROXY` / `HTTPS_PROXY` env vars cannot cover.

- The cert-only client builders are generalized to a single `ClientConfig { certs, proxy }`,
  so `add_root_certificate` and `proxy` are applied to the same crate-built client and
  either one alone triggers the build. An injected client is untouched, per slot.
- New `Error::InvalidProxy { source }`, deferred from the infallible setter to `build()` /
  `download_to` like the header and certificate errors. `check()` precedence is header,
  then certificate, then proxy.
- The password is redacted from the error text (including the wrapped client error, which
  may quote the URL) and from the hand-written `Debug` of `RequestConfig` and `Download`.
- reqwest applies the proxy alongside the env vars (first match wins); ureq has a single
  proxy slot, so the configured proxy replaces the env-var one. HTTP CONNECT only.
- Tests drive a real download through a loopback proxy stub at an unresolvable `.invalid`
  target host, covering both reqwest's absolute-form GET and ureq's CONNECT tunnel.

Completes CORP-3 in specs/corporate-network-config.md.
@jaemk
jaemk merged commit b779866 into master Sep 2, 2026
4 checks passed
@jaemk
jaemk deleted the 260901.corp3-proxy branch September 2, 2026 00:43
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.

1 participant