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

Commit e6837be

Browse files
badochovHubert Badocha
and
Hubert Badocha
authored
Added parameter to Start controlling if system proxy settings should be cleared. (#876)
Co-authored-by: Hubert Badocha <[email protected]>
1 parent e9e861f commit e6837be

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/Titanium.Web.Proxy/ProxyServer.cs

+6-4
Original file line numberDiff line numberDiff line change
@@ -586,7 +586,11 @@ public void DisableAllSystemProxies()
586586
/// <summary>
587587
/// Start this proxy server instance.
588588
/// </summary>
589-
public void Start()
589+
/// <param name="changeSystemProxySettings">
590+
/// Whether or not clear any system proxy settings which is pointing to our own endpoint (causing a cycle).
591+
/// E.g due to ungracious proxy shutdown before.
592+
/// </param>
593+
public void Start(bool changeSystemProxySettings = true)
590594
{
591595
if (ProxyRunning)
592596
{
@@ -600,9 +604,7 @@ public void Start()
600604
CertificateManager.EnsureRootCertificate();
601605
}
602606

603-
// clear any system proxy settings which is pointing to our own endpoint (causing a cycle)
604-
// due to ungracious proxy shutdown before or something else
605-
if (systemProxySettingsManager != null && RunTime.IsWindows && !RunTime.IsUwpOnWindows)
607+
if (changeSystemProxySettings && systemProxySettingsManager != null && RunTime.IsWindows && !RunTime.IsUwpOnWindows)
606608
{
607609
var proxyInfo = systemProxySettingsManager.GetProxyInfoFromRegistry();
608610
if (proxyInfo?.Proxies != null)

0 commit comments

Comments
 (0)