Commit 1b1bda0e authored by Honfika's avatar Honfika

Excluded => !DecryptSsl (#407)

parent 7da0f110
......@@ -80,8 +80,6 @@ namespace Titanium.Web.Proxy.Examples.Basic
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
//Optimizes performance by not creating a certificate for each https-enabled domain
//Useful when certificate trust is not required by proxy clients
......@@ -152,7 +150,7 @@ namespace Titanium.Web.Proxy.Examples.Basic
//Exclude Https addresses you don't want to proxy
//Useful for clients that use certificate pinning
//for example dropbox.com
e.Excluded = true;
e.DecryptSsl = false;
}
}
......
......@@ -119,7 +119,7 @@ namespace Titanium.Web.Proxy.Examples.Wpf
string hostname = e.WebSession.Request.RequestUri.Host;
if (hostname.EndsWith("webex.com"))
{
e.Excluded = true;
e.DecryptSsl = false;
}
await Dispatcher.InvokeAsync(() =>
......
......@@ -66,8 +66,6 @@ proxyServer.ClientCertificateSelectionCallback += OnCertificateSelection;
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
//Optimizes performance by not creating a certificate for each https-enabled domain
//Useful when certificate trust is not required by proxy clients
......@@ -135,7 +133,7 @@ private async Task OnBeforeTunnelConnectRequest(object sender, TunnelConnectSess
//Exclude Https addresses you don't want to proxy
//Useful for clients that use certificate pinning
//for example dropbox.com
e.Excluded = true;
e.DecryptSsl = false;
}
}
......
......@@ -6,7 +6,7 @@ namespace Titanium.Web.Proxy.EventArguments
{
public class TunnelConnectSessionEventArgs : SessionEventArgs
{
public bool Excluded { get; set; }
public bool DecryptSsl { get; set; } = true;
public bool IsHttpsConnect { get; internal set; }
......
......@@ -25,7 +25,7 @@ namespace Titanium.Web.Proxy.Models
/// <summary>
/// Intercept tunnel connect request
/// 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>
public event AsyncEventHandler<TunnelConnectSessionEventArgs> BeforeTunnelConnectRequest;
......
......@@ -79,7 +79,7 @@ namespace Titanium.Web.Proxy
await endPoint.InvokeBeforeTunnelConnectRequest(this, connectArgs, ExceptionFunc);
//filter out excluded host names
bool excluded = !endPoint.DecryptSsl || connectArgs.Excluded;
bool decryptSsl = endPoint.DecryptSsl && connectArgs.DecryptSsl;
if (await CheckAuthorization(connectArgs) == false)
{
......@@ -109,7 +109,7 @@ namespace Titanium.Web.Proxy
await endPoint.InvokeBeforeTunnectConnectResponse(this, connectArgs, ExceptionFunc, isClientHello);
if (!excluded && isClientHello)
if (decryptSsl && isClientHello)
{
connectRequest.RequestUri = new Uri("https://" + httpUrl);
......@@ -143,12 +143,12 @@ namespace Titanium.Web.Proxy
if (await HttpHelper.IsConnectMethod(clientStream) == -1)
{
// 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
if (excluded || !isClientHello)
if (!decryptSsl || !isClientHello)
{
//create new connection
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