diff --git a/README.md b/README.md index b7e366ee7..f7ae16734 100644 --- a/README.md +++ b/README.md @@ -17,8 +17,7 @@ Features * Safely relays Web Socket requests over HTTP * Support mutual SSL authentication * Fully asynchronous proxy -* Supports proxy authentication - +* Supports proxy authentication & automatic proxy detection Usage ===== @@ -204,10 +203,8 @@ public Task OnCertificateSelection(object sender, CertificateSelectionEventArgs ``` Future road map (Pull requests are welcome!) ============ +* Implement Kerberos/NTLM authentication over HTTP protocols for windows domain * Support Server Name Indication (SNI) for transparent endpoints * Support HTTP 2.0 -* Support upstream AutoProxy detection * Support SOCKS protocol -* Implement Kerberos/NTLM authentication over HTTP protocols for windows domain - diff --git a/Titanium.Web.Proxy/Models/ExternalProxy.cs b/Titanium.Web.Proxy/Models/ExternalProxy.cs index e1516a477..5922c3a47 100644 --- a/Titanium.Web.Proxy/Models/ExternalProxy.cs +++ b/Titanium.Web.Proxy/Models/ExternalProxy.cs @@ -21,7 +21,7 @@ public class ExternalProxy /// /// Bypass this proxy for connections to localhost? /// - public bool BypassForLocalhost { get; set; } + public bool BypassLocalhost { get; set; } /// /// Username. diff --git a/Titanium.Web.Proxy/Network/Tcp/TcpConnectionFactory.cs b/Titanium.Web.Proxy/Network/Tcp/TcpConnectionFactory.cs index 4567dff61..7940afb19 100644 --- a/Titanium.Web.Proxy/Network/Tcp/TcpConnectionFactory.cs +++ b/Titanium.Web.Proxy/Network/Tcp/TcpConnectionFactory.cs @@ -39,10 +39,37 @@ internal async Task CreateClient(ProxyServer server, TcpClient client; CustomBufferedStream stream; - bool isLocalhost = (externalHttpsProxy != null || externalHttpProxy != null) && NetworkHelper.IsLocalIpAddress(remoteHostName); + + bool useHttpProxy = false; + + //check if external proxy is set for HTTP + if (!isHttps && externalHttpProxy != null + && externalHttpProxy.HostName != remoteHostName) + { + useHttpProxy = true; + + //check if we need to ByPass + if (externalHttpProxy.BypassLocalhost + && NetworkHelper.IsLocalIpAddress(remoteHostName)) + { + useHttpProxy = false; + } + } - bool useHttpsProxy = externalHttpsProxy != null && externalHttpsProxy.HostName != remoteHostName && externalHttpsProxy.BypassForLocalhost && !isLocalhost; - bool useHttpProxy = externalHttpProxy != null && externalHttpProxy.HostName != remoteHostName && externalHttpProxy.BypassForLocalhost && !isLocalhost; + bool useHttpsProxy = false; + //check if external proxy is set for HTTPS + if (isHttps && externalHttpsProxy != null + && externalHttpsProxy.HostName != remoteHostName) + { + useHttpsProxy = true; + + //check if we need to ByPass + if (externalHttpsProxy.BypassLocalhost + && NetworkHelper.IsLocalIpAddress(remoteHostName)) + { + useHttpsProxy = false; + } + } if (isHttps) {