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

Commit 1b1bda0

Browse files
committed
Excluded => !DecryptSsl (#407)
1 parent 7da0f11 commit 1b1bda0

File tree

6 files changed

+9
-13
lines changed

6 files changed

+9
-13
lines changed

Examples/Titanium.Web.Proxy.Examples.Basic/ProxyTestController.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,6 @@ public void StartProxy()
8080

8181
explicitEndPoint = new ExplicitProxyEndPoint(IPAddress.Any, 8000)
8282
{
83-
//You can set only one of the ExcludedHttpsHostNameRegex and IncludedHttpsHostNameRegex properties, otherwise ArgumentException will be thrown
84-
8583
//Use self-issued generic certificate on all https requests
8684
//Optimizes performance by not creating a certificate for each https-enabled domain
8785
//Useful when certificate trust is not required by proxy clients
@@ -152,7 +150,7 @@ private async Task OnBeforeTunnelConnectRequest(object sender, TunnelConnectSess
152150
//Exclude Https addresses you don't want to proxy
153151
//Useful for clients that use certificate pinning
154152
//for example dropbox.com
155-
e.Excluded = true;
153+
e.DecryptSsl = false;
156154
}
157155
}
158156

Examples/Titanium.Web.Proxy.Examples.Wpf/MainWindow.xaml.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ private async Task ProxyServer_BeforeTunnelConnectRequest(object sender, TunnelC
119119
string hostname = e.WebSession.Request.RequestUri.Host;
120120
if (hostname.EndsWith("webex.com"))
121121
{
122-
e.Excluded = true;
122+
e.DecryptSsl = false;
123123
}
124124

125125
await Dispatcher.InvokeAsync(() =>

README.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,6 @@ proxyServer.ClientCertificateSelectionCallback += OnCertificateSelection;
6666

6767
var explicitEndPoint = new ExplicitProxyEndPoint(IPAddress.Any, 8000, true)
6868
{
69-
//You can set only one of the ExcludedHttpsHostNameRegex and IncludedHttpsHostNameRegex properties, otherwise ArgumentException will be thrown
70-
7169
//Use self-issued generic certificate on all https requests
7270
//Optimizes performance by not creating a certificate for each https-enabled domain
7371
//Useful when certificate trust is not required by proxy clients
@@ -135,7 +133,7 @@ private async Task OnBeforeTunnelConnectRequest(object sender, TunnelConnectSess
135133
//Exclude Https addresses you don't want to proxy
136134
//Useful for clients that use certificate pinning
137135
//for example dropbox.com
138-
e.Excluded = true;
136+
e.DecryptSsl = false;
139137
}
140138
}
141139

Titanium.Web.Proxy/EventArguments/TunnelConnectEventArgs.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ namespace Titanium.Web.Proxy.EventArguments
66
{
77
public class TunnelConnectSessionEventArgs : SessionEventArgs
88
{
9-
public bool Excluded { get; set; }
9+
public bool DecryptSsl { get; set; } = true;
1010

1111
public bool IsHttpsConnect { get; internal set; }
1212

Titanium.Web.Proxy/Models/ExplicitProxyEndPoint.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public class ExplicitProxyEndPoint : ProxyEndPoint
2525
/// <summary>
2626
/// Intercept tunnel connect request
2727
/// Valid only for explicit endpoints
28-
/// Set the <see cref="TunnelConnectSessionEventArgs.Excluded"/> property to true if this HTTP connect request should'nt be decrypted and instead be relayed
28+
/// Set the <see cref="TunnelConnectSessionEventArgs.DecryptSsl"/> property to false if this HTTP connect request should'nt be decrypted and instead be relayed
2929
/// </summary>
3030
public event AsyncEventHandler<TunnelConnectSessionEventArgs> BeforeTunnelConnectRequest;
3131

Titanium.Web.Proxy/RequestHandler.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ private async Task HandleClient(ExplicitProxyEndPoint endPoint, TcpClient tcpCli
7979
await endPoint.InvokeBeforeTunnelConnectRequest(this, connectArgs, ExceptionFunc);
8080

8181
//filter out excluded host names
82-
bool excluded = !endPoint.DecryptSsl || connectArgs.Excluded;
82+
bool decryptSsl = endPoint.DecryptSsl && connectArgs.DecryptSsl;
8383

8484
if (await CheckAuthorization(connectArgs) == false)
8585
{
@@ -109,7 +109,7 @@ private async Task HandleClient(ExplicitProxyEndPoint endPoint, TcpClient tcpCli
109109

110110
await endPoint.InvokeBeforeTunnectConnectResponse(this, connectArgs, ExceptionFunc, isClientHello);
111111

112-
if (!excluded && isClientHello)
112+
if (decryptSsl && isClientHello)
113113
{
114114
connectRequest.RequestUri = new Uri("https://" + httpUrl);
115115

@@ -143,12 +143,12 @@ private async Task HandleClient(ExplicitProxyEndPoint endPoint, TcpClient tcpCli
143143
if (await HttpHelper.IsConnectMethod(clientStream) == -1)
144144
{
145145
// It can be for example some Google (Cloude Messaging for Chrome) magic
146-
excluded = true;
146+
decryptSsl = false;
147147
}
148148
}
149149

150150
//Hostname is excluded or it is not an HTTPS connect
151-
if (excluded || !isClientHello)
151+
if (!decryptSsl || !isClientHello)
152152
{
153153
//create new connection
154154
using (var connection = await GetServerConnection(connectArgs, true))

0 commit comments

Comments
 (0)