Commit 1b1bda0e authored by Honfika's avatar Honfika

Excluded => !DecryptSsl (#407)

parent 7da0f110
...@@ -80,8 +80,6 @@ namespace Titanium.Web.Proxy.Examples.Basic ...@@ -80,8 +80,6 @@ namespace Titanium.Web.Proxy.Examples.Basic
explicitEndPoint = new ExplicitProxyEndPoint(IPAddress.Any, 8000) explicitEndPoint = new ExplicitProxyEndPoint(IPAddress.Any, 8000)
{ {
//You can set only one of the ExcludedHttpsHostNameRegex and IncludedHttpsHostNameRegex properties, otherwise ArgumentException will be thrown
//Use self-issued generic certificate on all https requests //Use self-issued generic certificate on all https requests
//Optimizes performance by not creating a certificate for each https-enabled domain //Optimizes performance by not creating a certificate for each https-enabled domain
//Useful when certificate trust is not required by proxy clients //Useful when certificate trust is not required by proxy clients
...@@ -152,7 +150,7 @@ namespace Titanium.Web.Proxy.Examples.Basic ...@@ -152,7 +150,7 @@ namespace Titanium.Web.Proxy.Examples.Basic
//Exclude Https addresses you don't want to proxy //Exclude Https addresses you don't want to proxy
//Useful for clients that use certificate pinning //Useful for clients that use certificate pinning
//for example dropbox.com //for example dropbox.com
e.Excluded = true; e.DecryptSsl = false;
} }
} }
......
...@@ -119,7 +119,7 @@ namespace Titanium.Web.Proxy.Examples.Wpf ...@@ -119,7 +119,7 @@ namespace Titanium.Web.Proxy.Examples.Wpf
string hostname = e.WebSession.Request.RequestUri.Host; string hostname = e.WebSession.Request.RequestUri.Host;
if (hostname.EndsWith("webex.com")) if (hostname.EndsWith("webex.com"))
{ {
e.Excluded = true; e.DecryptSsl = false;
} }
await Dispatcher.InvokeAsync(() => await Dispatcher.InvokeAsync(() =>
......
...@@ -66,8 +66,6 @@ proxyServer.ClientCertificateSelectionCallback += OnCertificateSelection; ...@@ -66,8 +66,6 @@ proxyServer.ClientCertificateSelectionCallback += OnCertificateSelection;
var explicitEndPoint = new ExplicitProxyEndPoint(IPAddress.Any, 8000, true) var explicitEndPoint = new ExplicitProxyEndPoint(IPAddress.Any, 8000, true)
{ {
//You can set only one of the ExcludedHttpsHostNameRegex and IncludedHttpsHostNameRegex properties, otherwise ArgumentException will be thrown
//Use self-issued generic certificate on all https requests //Use self-issued generic certificate on all https requests
//Optimizes performance by not creating a certificate for each https-enabled domain //Optimizes performance by not creating a certificate for each https-enabled domain
//Useful when certificate trust is not required by proxy clients //Useful when certificate trust is not required by proxy clients
...@@ -135,7 +133,7 @@ private async Task OnBeforeTunnelConnectRequest(object sender, TunnelConnectSess ...@@ -135,7 +133,7 @@ private async Task OnBeforeTunnelConnectRequest(object sender, TunnelConnectSess
//Exclude Https addresses you don't want to proxy //Exclude Https addresses you don't want to proxy
//Useful for clients that use certificate pinning //Useful for clients that use certificate pinning
//for example dropbox.com //for example dropbox.com
e.Excluded = true; e.DecryptSsl = false;
} }
} }
......
...@@ -6,7 +6,7 @@ namespace Titanium.Web.Proxy.EventArguments ...@@ -6,7 +6,7 @@ namespace Titanium.Web.Proxy.EventArguments
{ {
public class TunnelConnectSessionEventArgs : SessionEventArgs public class TunnelConnectSessionEventArgs : SessionEventArgs
{ {
public bool Excluded { get; set; } public bool DecryptSsl { get; set; } = true;
public bool IsHttpsConnect { get; internal set; } public bool IsHttpsConnect { get; internal set; }
......
...@@ -25,7 +25,7 @@ namespace Titanium.Web.Proxy.Models ...@@ -25,7 +25,7 @@ namespace Titanium.Web.Proxy.Models
/// <summary> /// <summary>
/// Intercept tunnel connect request /// Intercept tunnel connect request
/// Valid only for explicit endpoints /// Valid only for explicit endpoints
/// Set the <see cref="TunnelConnectSessionEventArgs.Excluded"/> property to true if this HTTP connect request should'nt be decrypted and instead be relayed /// Set the <see cref="TunnelConnectSessionEventArgs.DecryptSsl"/> property to false if this HTTP connect request should'nt be decrypted and instead be relayed
/// </summary> /// </summary>
public event AsyncEventHandler<TunnelConnectSessionEventArgs> BeforeTunnelConnectRequest; public event AsyncEventHandler<TunnelConnectSessionEventArgs> BeforeTunnelConnectRequest;
......
...@@ -79,7 +79,7 @@ namespace Titanium.Web.Proxy ...@@ -79,7 +79,7 @@ namespace Titanium.Web.Proxy
await endPoint.InvokeBeforeTunnelConnectRequest(this, connectArgs, ExceptionFunc); await endPoint.InvokeBeforeTunnelConnectRequest(this, connectArgs, ExceptionFunc);
//filter out excluded host names //filter out excluded host names
bool excluded = !endPoint.DecryptSsl || connectArgs.Excluded; bool decryptSsl = endPoint.DecryptSsl && connectArgs.DecryptSsl;
if (await CheckAuthorization(connectArgs) == false) if (await CheckAuthorization(connectArgs) == false)
{ {
...@@ -109,7 +109,7 @@ namespace Titanium.Web.Proxy ...@@ -109,7 +109,7 @@ namespace Titanium.Web.Proxy
await endPoint.InvokeBeforeTunnectConnectResponse(this, connectArgs, ExceptionFunc, isClientHello); await endPoint.InvokeBeforeTunnectConnectResponse(this, connectArgs, ExceptionFunc, isClientHello);
if (!excluded && isClientHello) if (decryptSsl && isClientHello)
{ {
connectRequest.RequestUri = new Uri("https://" + httpUrl); connectRequest.RequestUri = new Uri("https://" + httpUrl);
...@@ -143,12 +143,12 @@ namespace Titanium.Web.Proxy ...@@ -143,12 +143,12 @@ namespace Titanium.Web.Proxy
if (await HttpHelper.IsConnectMethod(clientStream) == -1) if (await HttpHelper.IsConnectMethod(clientStream) == -1)
{ {
// It can be for example some Google (Cloude Messaging for Chrome) magic // It can be for example some Google (Cloude Messaging for Chrome) magic
excluded = true; decryptSsl = false;
} }
} }
//Hostname is excluded or it is not an HTTPS connect //Hostname is excluded or it is not an HTTPS connect
if (excluded || !isClientHello) if (!decryptSsl || !isClientHello)
{ {
//create new connection //create new connection
using (var connection = await GetServerConnection(connectArgs, true)) using (var connection = await GetServerConnection(connectArgs, true))
......
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