Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
T
Titanium-Web-Proxy
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Titanium-Web-Proxy
Commits
e7093f93
Commit
e7093f93
authored
Apr 12, 2018
by
justcoding121
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support terminate session anytime
parent
7eea65ab
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
59 additions
and
1 deletion
+59
-1
BeforeSslAuthenticateEventArgs.cs
...eb.Proxy/EventArguments/BeforeSslAuthenticateEventArgs.cs
+18
-0
SessionEventArgsBase.cs
Titanium.Web.Proxy/EventArguments/SessionEventArgsBase.cs
+5
-0
TransparentProxyEndPoint.cs
Titanium.Web.Proxy/Models/TransparentProxyEndPoint.cs
+16
-0
RequestHandler.cs
Titanium.Web.Proxy/RequestHandler.cs
+20
-1
No files found.
Titanium.Web.Proxy/EventArguments/BeforeSslAuthenticateEventArgs.cs
0 → 100644
View file @
e7093f93
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
namespace
Titanium.Web.Proxy.EventArguments
{
public
class
BeforeSslAuthenticateEventArgs
:
EventArgs
{
public
string
SniHostName
{
get
;
internal
set
;
}
public
bool
DecryptSsl
{
get
;
set
;
}
=
true
;
public
bool
TerminateSession
{
get
;
set
;
}
}
}
Titanium.Web.Proxy/EventArguments/SessionEventArgsBase.cs
View file @
e7093f93
...
...
@@ -69,6 +69,11 @@ namespace Titanium.Web.Proxy.EventArguments
public
ProxyEndPoint
LocalEndPoint
{
get
;
}
/// <summary>
/// Terminates the session abruptly by terminating client/server connections
/// </summary>
public
bool
TerminateSession
{
get
;
set
;
}
public
bool
IsTransparent
=>
LocalEndPoint
is
TransparentProxyEndPoint
;
public
Exception
Exception
{
get
;
internal
set
;
}
...
...
Titanium.Web.Proxy/Models/TransparentProxyEndPoint.cs
View file @
e7093f93
using
System.Net
;
using
System.Threading.Tasks
;
using
Titanium.Web.Proxy.EventArguments
;
using
Titanium.Web.Proxy.Extensions
;
namespace
Titanium.Web.Proxy.Models
{
...
...
@@ -14,6 +17,11 @@ namespace Titanium.Web.Proxy.Models
/// </summary>
public
string
GenericCertificateName
{
get
;
set
;
}
/// <summary>
/// Before Ssl authentication
/// </summary>
public
event
AsyncEventHandler
<
BeforeSslAuthenticateEventArgs
>
BeforeSslAuthenticate
;
/// <summary>
/// Constructor.
/// </summary>
...
...
@@ -24,5 +32,13 @@ namespace Titanium.Web.Proxy.Models
{
GenericCertificateName
=
"localhost"
;
}
internal
async
Task
InvokeBeforeSslAuthenticate
(
ProxyServer
proxyServer
,
BeforeSslAuthenticateEventArgs
connectArgs
,
ExceptionHandler
exceptionFunc
)
{
if
(
BeforeSslAuthenticate
!=
null
)
{
await
BeforeSslAuthenticate
.
InvokeAsync
(
proxyServer
,
connectArgs
,
exceptionFunc
);
}
}
}
}
\ No newline at end of file
Titanium.Web.Proxy/RequestHandler.cs
View file @
e7093f93
...
...
@@ -164,6 +164,11 @@ namespace Titanium.Web.Proxy
}
}
if
(
connectArgs
.
TerminateSession
)
{
throw
new
Exception
(
"Session was terminated by user."
);
}
//Hostname is excluded or it is not an HTTPS connect
if
(!
decryptSsl
||
!
isClientHello
)
{
...
...
@@ -256,7 +261,15 @@ namespace Titanium.Web.Proxy
{
httpsHostName
=
clientHelloInfo
.
GetServerName
()
??
endPoint
.
GenericCertificateName
;
if
(
endPoint
.
DecryptSsl
)
var
args
=
new
BeforeSslAuthenticateEventArgs
();
await
endPoint
.
InvokeBeforeSslAuthenticate
(
this
,
args
,
ExceptionFunc
);
if
(
args
.
TerminateSession
)
{
throw
new
Exception
(
"Session was terminated by user."
);
}
if
(
endPoint
.
DecryptSsl
&&
args
.
DecryptSsl
)
{
SslStream
sslStream
=
null
;
...
...
@@ -548,9 +561,15 @@ namespace Titanium.Web.Proxy
}
finally
{
if
(
args
.
TerminateSession
)
{
throw
new
Exception
(
"Session was terminated by user."
);
}
await
InvokeAfterResponse
(
args
);
args
.
Dispose
();
}
}
}
finally
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment