fix(client): parse Windows per-scheme proxy settings - #324
Open
sb123sb123 wants to merge 1 commit into
Open
sb123sb123 wants to merge 1 commit into
sb123sb123 wants to merge 1 commit into
Conversation
Parse WinINET ProxyServer values before building the HTTP and HTTPS proxy matchers. Preserve single-proxy values, apply scheme-specific settings, and map SOCKS fallbacks to a supported URI scheme. Fixes #4067
This branch has not been deployed
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 hyperium/hyper#4067
Problem
On Windows, WinINET can store
ProxyServeras semicolon-separated per-protocol entries such ashttp=host:8080;https=host:8443;socks=host:1080.Matcher::from_system()currently passes that whole value to both proxy slots, so the matcher cannot use the configured proxies.Issue: hyperium/hyper#4067
Cause
The Windows system-proxy path treated
ProxyServeras only the legacy single-proxy form. The shared proxy URI parser then interpreted entries such assocks=host:1080as an invalid HTTP proxy value.Fix
Parse Windows
ProxyServerentries before building the matcher. Preserve the legacy single-proxy form, applyhttp=andhttps=entries to their respective slots, use a supportedsocks5://URI as the fallback forsocks=, and ignore unrelated entries. Explicit protocol entries take precedence over the SOCKS fallback, while environment values keep their existing precedence.Tests
cargo fmt --all -- --checkcargo test --target x86_64-pc-windows-msvc --lib --no-default-features --features client-proxy,client-proxy-system -- --nocapture(17 passed)cargo check --target x86_64-pc-windows-msvc --all-targets --no-default-features --features client-proxy,client-proxy-systemcargo clippy --target x86_64-pc-windows-msvc --all-targets --no-default-features --features client-proxy,client-proxy-system(passes with the two existing warnings noted below)Limitations
The regression tests exercise the Windows parser directly and do not modify the host Windows registry. Strict Clippy with
-D warningsremains blocked by two pre-existingunnecessary_map_orwarnings atsrc/client/proxy/matcher.rs:514and:518; those unrelated lines were not changed.AI assistance disclosure
This PR was prepared with autonomous AI assistance for issue inspection, implementation, testing, and PR preparation. The changes and test results are disclosed here for maintainer review.