Skip to content

Fix https proxy not set when pac is used - #40950

Merged
Feng Wang (chemwolf6922) merged 3 commits into
masterfrom
user/chemwolf6922/fix-https_proxy-not-set-when-PAC-is-used
Jul 3, 2026
Merged

Fix https proxy not set when pac is used#40950
Feng Wang (chemwolf6922) merged 3 commits into
masterfrom
user/chemwolf6922/fix-https_proxy-not-set-when-PAC-is-used

Conversation

@chemwolf6922

@chemwolf6922 Feng Wang (chemwolf6922) commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Summary of the Pull Request

PAC is not directly usable in WSL or in most headless Linux environments.
The WinHttpGetProxySettingsEx call only populates the pcwszProxy segment when PAC is enabled. And WSL only sets http_proxy but leaves https_proxy empty.
This PR sets both http_proxy and https_proxy to the default PAC query result as best effort.

PR Checklist

  • Closes:
  • Communication: I've discussed this with core contributors already. If work hasn't been agreed, this work might be rejected
  • Tests: Added/updated if needed and all pass
  • Localization: All end user facing strings can be localized
  • Dev docs: Added/updated if needed
  • Documentation updated: If checked, please file a pull request on our docs repo and link it here: #xxx

Detailed Description of the Pull Request / Additional comments

Validation Steps Performed

New unit tests:
NetworkTests::NetworkTests::NatHttpProxyPac
NetworkTests::MirroredTests::HttpProxyPac

Copilot AI review requested due to automatic review settings June 30, 2026 06:06
@chemwolf6922
Feng Wang (chemwolf6922) requested a review from a team as a code owner June 30, 2026 06:06

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses a WSL autoProxy/PAC scenario where WinHTTP proxy settings derived from a PAC script populate only the generic proxy field, causing WSL to set http_proxy but leave https_proxy empty. The change makes WSL populate https_proxy/HTTPS_PROXY from the PAC-derived proxy value when no secure proxy is provided, and adds regression coverage for both NAT and mirrored networking modes.

Changes:

  • Update environment injection to set https_proxy/HTTPS_PROXY to the PAC-derived proxy when SecureProxy is empty.
  • Extend network tests to cover PAC-based proxy configuration in both NAT and mirrored networking.
  • Ensure test cleanup clears AutoconfigUrl when resetting WinHTTP proxy settings.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
test/windows/NetworkTests.cpp Adds NAT + mirrored tests for PAC-based WinHTTP proxy propagation and updates proxy-reset helper to clear AutoconfigUrl.
src/windows/service/exe/LxssUserSession.cpp Falls back to setting https_proxy/HTTPS_PROXY from Proxy when PAC is configured and SecureProxy is empty.

Comment thread test/windows/NetworkTests.cpp Outdated

@OneBlue Blue (OneBlue) left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change LGTM, although I recommend making sure that #40945 doesn't get closed because that issue is about wslc, which doesn't support proxy right now

Comment thread test/windows/NetworkTests.cpp Outdated
Comment thread test/windows/NetworkTests.cpp Outdated
@chemwolf6922
Feng Wang (chemwolf6922) merged commit 533014f into master Jul 3, 2026
11 checks passed
@chemwolf6922
Feng Wang (chemwolf6922) deleted the user/chemwolf6922/fix-https_proxy-not-set-when-PAC-is-used branch July 3, 2026 02:19
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.

3 participants