Skip to content

Conversation

@ManickaP
Copy link
Member

Usage of WinInetProxyHelper was relevant only for legacy Windows 8.1-. Since 8.1, WinHTTP handles per-user proxies itself, see https://learn.microsoft.com/en-us/windows/win32/api/winhttp/nf-winhttp-winhttpopen.

Removed the helper from WinHttpHandler and moved the few tests to S.N.Http.UnitTests next to the other HttpWindowsProxy tests.

Note that HttpWindowsProxy is the last user of WinInetProxyHelper so I moved the source file from Common. I can move it back there if we think this has a potential for being shared.

@dotnet-policy-service
Copy link
Contributor

Tagging subscribers to this area: @dotnet/ncl
See info in area-owners.md if you want to be subscribed.

Copy link
Contributor

Copilot AI left a comment

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 removes the legacy WinInet proxy handling that was only used for Windows 8.1 and earlier. The key changes include:

  • Removing the WinInetProxyHelper usage and related legacy fallback code in WinHttpHandler.
  • Migrating and adding tests for HttpWindowsProxy in System.Net.Http.UnitTests.
  • Eliminating obsolete tests and TestControl properties from the WinHttpHandler unit tests.

Reviewed Changes

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

Show a summary per file
File Description
src/libraries/System.Net.Http/tests/UnitTests/HttpWindowsProxyTest.cs Added new tests for verifying manual proxy settings with auto-detection failures and manual-only scenarios.
src/libraries/System.Net.Http.WinHttpHandler/tests/UnitTests/WinHttpHandlerTest.cs Removed tests that relied on the legacy WinInet proxy handling and the WinHttpAutomaticProxySupport property.
src/libraries/System.Net.Http.WinHttpHandler/tests/UnitTests/TestControl.cs Removed obsolete WinHttpAutomaticProxySupport property.
src/libraries/System.Net.Http.WinHttpHandler/tests/UnitTests/FakeInterop.cs Removed legacy branch handling based on WinHttpAutomaticProxySupport.
src/libraries/System.Net.Http.WinHttpHandler/src/System/Net/Http/WinHttpHandler.cs Stripped legacy fallback logic for WinInet proxy detection and updated proxy option handling.
Files not reviewed (4)
  • src/libraries/System.Net.Http.WinHttpHandler/src/System.Net.Http.WinHttpHandler.csproj: Language not supported
  • src/libraries/System.Net.Http.WinHttpHandler/tests/UnitTests/System.Net.Http.WinHttpHandler.Unit.Tests.csproj: Language not supported
  • src/libraries/System.Net.Http/src/System.Net.Http.csproj: Language not supported
  • src/libraries/System.Net.Http/tests/UnitTests/System.Net.Http.Unit.Tests.csproj: Language not supported
Comments suppressed due to low confidence (1)

src/libraries/System.Net.Http.WinHttpHandler/src/System/Net/Http/WinHttpHandler.cs:815

  • Consider adding a comment here to clearly explain that the legacy fallback to WinInetProxyHelper has been removed, which will help future maintainers understand this intentional change.
ThrowOnInvalidHandle(sessionHandle, nameof(Interop.WinHttp.WinHttpOpen));

@ManickaP ManickaP merged commit 4f5c693 into dotnet:main Mar 28, 2025
83 of 87 checks passed
@ManickaP ManickaP deleted the winhttp-proxy branch March 28, 2025 08:44
thaystg pushed a commit to thaystg/runtime that referenced this pull request Apr 1, 2025
)

* Remove legacy (Win 8.1-) WinInet proxy handling

* Move WinInetProxyHelper to S.N.Http, the only place of usage.

* Removed unnecessary assert

* Remove tests and fakes for "no automatic proxy"
@github-actions github-actions bot locked and limited conversation to collaborators Apr 28, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants