Commit be556d21 authored by Honfika's avatar Honfika

remove proxy settings when it is probably remained there because a previous non graceful quit

parent 72d493a9
...@@ -31,7 +31,7 @@ namespace Titanium.Web.Proxy.Examples.Basic ...@@ -31,7 +31,7 @@ namespace Titanium.Web.Proxy.Examples.Basic
proxyServer.ExceptionFunc = exception => Console.WriteLine(exception.Message); proxyServer.ExceptionFunc = exception => Console.WriteLine(exception.Message);
proxyServer.TrustRootCertificate = true; proxyServer.TrustRootCertificate = true;
//proxyServer.ForwardToUpstreamGateway = true; proxyServer.ForwardToUpstreamGateway = true;
//optionally set the Certificate Engine //optionally set the Certificate Engine
//Under Mono only BouncyCastle will be supported //Under Mono only BouncyCastle will be supported
......
...@@ -500,6 +500,23 @@ namespace Titanium.Web.Proxy ...@@ -500,6 +500,23 @@ namespace Titanium.Web.Proxy
throw new Exception("Proxy is already running."); throw new Exception("Proxy is already running.");
} }
if (systemProxySettingsManager != null)
{
var proxyInfo = systemProxySettingsManager.GetProxyInfoFromRegistry();
if (proxyInfo.Proxies != null)
{
var proxies = proxyInfo.Proxies.ToArray();
foreach (var proxy in proxies)
{
var value = proxy.Value;
if (value.HostName == "127.0.0.1" && ProxyEndPoints.Any(x => x.Port == value.Port))
{
systemProxySettingsManager.RemoveProxy(value.ProtocolType);
}
}
}
}
if (ForwardToUpstreamGateway if (ForwardToUpstreamGateway
&& GetCustomUpStreamHttpProxyFunc == null && GetCustomUpStreamHttpsProxyFunc == null && GetCustomUpStreamHttpProxyFunc == null && GetCustomUpStreamHttpsProxyFunc == null
&& systemProxySettingsManager != null) && systemProxySettingsManager != null)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment