-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Open
Labels
area-System.Net.HttpenhancementProduct code improvement that does NOT require public API changes/additionsProduct code improvement that does NOT require public API changes/additions
Milestone
Description
Background and motivation
When troubleshooting a live application, it would be nice to be able to open Fiddler and (nearly) immediately see HTTP requests flowing through it.
Unfortunately, the current HTTPClient / HttpClient.DefaultProxy is not suitable for this. The first time it is called it seems to capture the value from SystemProxyInfo.ConstructSystemProxy and cache is for the life of the application. This results in needing reflection or other methods in order to retrieve the actualy current system proxy information.
API Proposal
namespace System.Net.Http;
public static class WebProxy
{
public static IWebProxy GetSystemProxy();
}
API Usage
// Fancy the value
var Proxy = System.Net.Http.WebProxy.GetSystemProxy();
Alternative Designs
Leave as-is.
Risks
I assume that SystemProxyInfo.ConstructSystemProxy is a heavy method. Users of this function might call it too frequently.
Metadata
Metadata
Assignees
Labels
area-System.Net.HttpenhancementProduct code improvement that does NOT require public API changes/additionsProduct code improvement that does NOT require public API changes/additions