add a proxy() setter with credential support - #210
Merged
Merged
Conversation
`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.
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.
Adds
proxy(url)on everyUpdate/ReleaseListbuilder and onDownload, for the authenticatedproxy case
HTTP_PROXY/HTTPS_PROXYcannot cover. Completes CORP-3 inspecs/corporate-network-config.md.
proxy(url)torequest_config_setters!and toDownload. Credentials may be embedded inthe URL (
http://user:pass@proxy.corp:8080) and are sent asProxy-Authorization. HTTP CONNECTonly.
ClientConfig { certs, proxy }feedingbuild_configured_client/build_configured_async_client, soadd_root_certificateandproxyare applied to the same crate-built client and either one alone triggers the build. Aninjected client still wins, per slot.
Error::InvalidProxy { source }, deferred from the infallible setter tobuild()/download_tolike the header and certificate errors.check()precedence is header, thencertificate, 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.
quote the URL) and from the hand-written
DebugofRequestConfigandDownload.build_download, so the release listing and the assetfetch take the same route.
slot, so the configured proxy replaces the env-var one.
Tests drive a real download through a loopback proxy stub at an unresolvable
.invalidtargethost, covering both reqwest's absolute-form GET and ureq's CONNECT tunnel, plus unit coverage for
the error attribution, the redaction, the
Downloadforwarding, and the builder surface.make ciis green.