Skip to content
This repository has been archived by the owner on Jul 9, 2023. It is now read-only.

Commit

Permalink
Added parameter to Start controlling if system proxy settings should …
Browse files Browse the repository at this point in the history
…be cleared. (#876)

Co-authored-by: Hubert Badocha <[email protected]>
  • Loading branch information
badochov and Hubert Badocha authored Sep 8, 2021
1 parent e9e861f commit e6837be
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/Titanium.Web.Proxy/ProxyServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,11 @@ public void DisableAllSystemProxies()
/// <summary>
/// Start this proxy server instance.
/// </summary>
public void Start()
/// <param name="changeSystemProxySettings">
/// Whether or not clear any system proxy settings which is pointing to our own endpoint (causing a cycle).
/// E.g due to ungracious proxy shutdown before.
/// </param>
public void Start(bool changeSystemProxySettings = true)
{
if (ProxyRunning)
{
Expand All @@ -600,9 +604,7 @@ public void Start()
CertificateManager.EnsureRootCertificate();
}

// clear any system proxy settings which is pointing to our own endpoint (causing a cycle)
// due to ungracious proxy shutdown before or something else
if (systemProxySettingsManager != null && RunTime.IsWindows && !RunTime.IsUwpOnWindows)
if (changeSystemProxySettings && systemProxySettingsManager != null && RunTime.IsWindows && !RunTime.IsUwpOnWindows)
{
var proxyInfo = systemProxySettingsManager.GetProxyInfoFromRegistry();
if (proxyInfo?.Proxies != null)
Expand Down

0 comments on commit e6837be

Please sign in to comment.