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
341c29ec
Commit
341c29ec
authored
May 19, 2017
by
Jehonathan Thomas
Committed by
GitHub
May 19, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #241 from justcoding121/develop
add TLS cert revocation check flag; cleanup
parents
6a66e7b1
83cca8a5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
32 additions
and
17 deletions
+32
-17
Tcp.cs
Titanium.Web.Proxy/Helpers/Tcp.cs
+1
-1
TcpConnectionFactory.cs
Titanium.Web.Proxy/Network/Tcp/TcpConnectionFactory.cs
+3
-2
ProxyServer.cs
Titanium.Web.Proxy/ProxyServer.cs
+26
-6
RequestHandler.cs
Titanium.Web.Proxy/RequestHandler.cs
+0
-6
ResponseHandler.cs
Titanium.Web.Proxy/ResponseHandler.cs
+2
-2
No files found.
Titanium.Web.Proxy/Helpers/Tcp.cs
View file @
341c29ec
...
@@ -229,7 +229,7 @@ namespace Titanium.Web.Proxy.Helpers
...
@@ -229,7 +229,7 @@ namespace Titanium.Web.Proxy.Helpers
finally
finally
{
{
tcpConnection
.
Dispose
();
tcpConnection
.
Dispose
();
Interlocked
.
Decrement
(
ref
server
.
ServerConnectionCountField
);
Interlocked
.
Decrement
(
ref
server
.
serverConnectionCount
);
}
}
}
}
}
}
...
...
Titanium.Web.Proxy/Network/Tcp/TcpConnectionFactory.cs
View file @
341c29ec
...
@@ -95,12 +95,13 @@ namespace Titanium.Web.Proxy.Network.Tcp
...
@@ -95,12 +95,13 @@ namespace Titanium.Web.Proxy.Network.Tcp
sslStream
=
new
SslStream
(
stream
,
true
,
server
.
ValidateServerCertificate
,
sslStream
=
new
SslStream
(
stream
,
true
,
server
.
ValidateServerCertificate
,
server
.
SelectClientCertificate
);
server
.
SelectClientCertificate
);
await
sslStream
.
AuthenticateAsClientAsync
(
remoteHostName
,
null
,
server
.
SupportedSslProtocols
,
false
);
await
sslStream
.
AuthenticateAsClientAsync
(
remoteHostName
,
null
,
server
.
SupportedSslProtocols
,
server
.
CheckCertificateRevocation
);
stream
=
new
CustomBufferedStream
(
sslStream
,
server
.
BufferSize
);
stream
=
new
CustomBufferedStream
(
sslStream
,
server
.
BufferSize
);
}
}
catch
catch
{
{
sslStream
?.
Close
();
sslStream
?.
Dispose
();
sslStream
?.
Dispose
();
throw
;
throw
;
...
@@ -125,7 +126,7 @@ namespace Titanium.Web.Proxy.Network.Tcp
...
@@ -125,7 +126,7 @@ namespace Titanium.Web.Proxy.Network.Tcp
client
.
ReceiveTimeout
=
server
.
ConnectionTimeOutSeconds
*
1000
;
client
.
ReceiveTimeout
=
server
.
ConnectionTimeOutSeconds
*
1000
;
client
.
SendTimeout
=
server
.
ConnectionTimeOutSeconds
*
1000
;
client
.
SendTimeout
=
server
.
ConnectionTimeOutSeconds
*
1000
;
Interlocked
.
Increment
(
ref
server
.
ServerConnectionCountField
);
Interlocked
.
Increment
(
ref
server
.
serverConnectionCount
);
return
new
TcpConnection
return
new
TcpConnection
{
{
...
...
Titanium.Web.Proxy/ProxyServer.cs
View file @
341c29ec
...
@@ -35,9 +35,20 @@ namespace Titanium.Web.Proxy
...
@@ -35,9 +35,20 @@ namespace Titanium.Web.Proxy
/// </summary>
/// </summary>
private
Action
<
Exception
>
exceptionFunc
;
private
Action
<
Exception
>
exceptionFunc
;
/// <summary>
/// Backing field for corresponding public property
/// </summary>
private
bool
trustRootCertificate
;
private
bool
trustRootCertificate
;
private
int
clientConnectionCountField
;
internal
int
ServerConnectionCountField
;
/// <summary>
/// Backing field for corresponding public property
/// </summary>
private
int
clientConnectionCount
;
/// <summary>
/// Backing field for corresponding public property
/// </summary>
internal
int
serverConnectionCount
;
/// <summary>
/// <summary>
/// A object that creates tcp connection to server
/// A object that creates tcp connection to server
...
@@ -127,6 +138,12 @@ namespace Titanium.Web.Proxy
...
@@ -127,6 +138,12 @@ namespace Titanium.Web.Proxy
set
{
CertificateManager
.
Engine
=
value
;
}
set
{
CertificateManager
.
Engine
=
value
;
}
}
}
/// <summary>
/// Should we check for certificare revocation during SSL authentication to servers
/// Note: If enabled can reduce performance (Default disabled)
/// </summary>
public
bool
CheckCertificateRevocation
{
get
;
set
;
}
/// <summary>
/// <summary>
/// Does this proxy uses the HTTP protocol 100 continue behaviour strictly?
/// Does this proxy uses the HTTP protocol 100 continue behaviour strictly?
/// Broken 100 contunue implementations on server/client may cause problems if enabled
/// Broken 100 contunue implementations on server/client may cause problems if enabled
...
@@ -231,13 +248,13 @@ namespace Titanium.Web.Proxy
...
@@ -231,13 +248,13 @@ namespace Titanium.Web.Proxy
/// <summary>
/// <summary>
/// Total number of active client connections
/// Total number of active client connections
/// </summary>
/// </summary>
public
int
ClientConnectionCount
=>
clientConnectionCount
Field
;
public
int
ClientConnectionCount
=>
clientConnectionCount
;
/// <summary>
/// <summary>
/// Total number of active server connections
/// Total number of active server connections
/// </summary>
/// </summary>
public
int
ServerConnectionCount
=>
ServerConnectionCountField
;
public
int
ServerConnectionCount
=>
serverConnectionCount
;
/// <summary>
/// <summary>
/// Constructor
/// Constructor
...
@@ -597,7 +614,10 @@ namespace Titanium.Web.Proxy
...
@@ -597,7 +614,10 @@ namespace Titanium.Web.Proxy
{
{
Task
.
Run
(
async
()
=>
Task
.
Run
(
async
()
=>
{
{
Interlocked
.
Increment
(
ref
clientConnectionCountField
);
Interlocked
.
Increment
(
ref
clientConnectionCount
);
tcpClient
.
ReceiveTimeout
=
ConnectionTimeOutSeconds
*
1000
;
tcpClient
.
SendTimeout
=
ConnectionTimeOutSeconds
*
1000
;
try
try
{
{
...
@@ -612,7 +632,7 @@ namespace Titanium.Web.Proxy
...
@@ -612,7 +632,7 @@ namespace Titanium.Web.Proxy
}
}
finally
finally
{
{
Interlocked
.
Decrement
(
ref
clientConnectionCount
Field
);
Interlocked
.
Decrement
(
ref
clientConnectionCount
);
try
try
{
{
...
...
Titanium.Web.Proxy/RequestHandler.cs
View file @
341c29ec
...
@@ -36,9 +36,6 @@ namespace Titanium.Web.Proxy
...
@@ -36,9 +36,6 @@ namespace Titanium.Web.Proxy
var
clientStream
=
new
CustomBufferedStream
(
tcpClient
.
GetStream
(),
BufferSize
);
var
clientStream
=
new
CustomBufferedStream
(
tcpClient
.
GetStream
(),
BufferSize
);
clientStream
.
ReadTimeout
=
ConnectionTimeOutSeconds
*
1000
;
clientStream
.
WriteTimeout
=
ConnectionTimeOutSeconds
*
1000
;
var
clientStreamReader
=
new
CustomBinaryReader
(
clientStream
,
BufferSize
);
var
clientStreamReader
=
new
CustomBinaryReader
(
clientStream
,
BufferSize
);
var
clientStreamWriter
=
new
StreamWriter
(
clientStream
)
{
NewLine
=
ProxyConstants
.
NewLine
};
var
clientStreamWriter
=
new
StreamWriter
(
clientStream
)
{
NewLine
=
ProxyConstants
.
NewLine
};
...
@@ -187,9 +184,6 @@ namespace Titanium.Web.Proxy
...
@@ -187,9 +184,6 @@ namespace Titanium.Web.Proxy
bool
disposed
=
false
;
bool
disposed
=
false
;
var
clientStream
=
new
CustomBufferedStream
(
tcpClient
.
GetStream
(),
BufferSize
);
var
clientStream
=
new
CustomBufferedStream
(
tcpClient
.
GetStream
(),
BufferSize
);
clientStream
.
ReadTimeout
=
ConnectionTimeOutSeconds
*
1000
;
clientStream
.
WriteTimeout
=
ConnectionTimeOutSeconds
*
1000
;
CustomBinaryReader
clientStreamReader
=
null
;
CustomBinaryReader
clientStreamReader
=
null
;
StreamWriter
clientStreamWriter
=
null
;
StreamWriter
clientStreamWriter
=
null
;
...
...
Titanium.Web.Proxy/ResponseHandler.cs
View file @
341c29ec
...
@@ -49,7 +49,7 @@ namespace Titanium.Web.Proxy
...
@@ -49,7 +49,7 @@ namespace Titanium.Web.Proxy
if
(
args
.
WebSession
.
ServerConnection
!=
null
)
if
(
args
.
WebSession
.
ServerConnection
!=
null
)
{
{
args
.
WebSession
.
ServerConnection
.
Dispose
();
args
.
WebSession
.
ServerConnection
.
Dispose
();
Interlocked
.
Decrement
(
ref
ServerConnectionCountField
);
Interlocked
.
Decrement
(
ref
serverConnectionCount
);
}
}
var
connection
=
await
GetServerConnection
(
args
);
var
connection
=
await
GetServerConnection
(
args
);
...
@@ -240,7 +240,7 @@ namespace Titanium.Web.Proxy
...
@@ -240,7 +240,7 @@ namespace Titanium.Web.Proxy
if
(
serverConnection
!=
null
)
if
(
serverConnection
!=
null
)
{
{
serverConnection
.
Dispose
();
serverConnection
.
Dispose
();
Interlocked
.
Decrement
(
ref
ServerConnectionCountField
);
Interlocked
.
Decrement
(
ref
serverConnectionCount
);
}
}
}
}
}
}
...
...
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