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
e1cf60d6
Commit
e1cf60d6
authored
Jul 17, 2016
by
justcoding121
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#87 Fix abrupt termination of SSL connections
parent
44ba131c
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
21 additions
and
12 deletions
+21
-12
Tcp.cs
Titanium.Web.Proxy/Helpers/Tcp.cs
+5
-6
TcpConnection.cs
Titanium.Web.Proxy/Network/TcpConnection.cs
+6
-2
TcpConnectionFactory.cs
Titanium.Web.Proxy/Network/TcpConnectionFactory.cs
+2
-0
ProxyServer.cs
Titanium.Web.Proxy/ProxyServer.cs
+8
-2
ResponseHandler.cs
Titanium.Web.Proxy/ResponseHandler.cs
+0
-2
No files found.
Titanium.Web.Proxy/Helpers/Tcp.cs
View file @
e1cf60d6
...
@@ -65,19 +65,18 @@ namespace Titanium.Web.Proxy.Helpers
...
@@ -65,19 +65,18 @@ namespace Titanium.Web.Proxy.Helpers
sb
.
Append
(
Environment
.
NewLine
);
sb
.
Append
(
Environment
.
NewLine
);
}
}
var
tcpConnection
=
await
tcpConnectionFactory
.
CreateClient
(
bufferSize
,
connectionTimeOutSeconds
,
var
tcpConnection
=
await
tcpConnectionFactory
.
CreateClient
(
bufferSize
,
connectionTimeOutSeconds
,
remoteHostName
,
remotePort
,
remoteHostName
,
remotePort
,
httpVersion
,
isHttps
,
httpVersion
,
isHttps
,
supportedProtocols
,
remoteCertificateValidationCallback
,
localCertificateSelectionCallback
,
supportedProtocols
,
remoteCertificateValidationCallback
,
localCertificateSelectionCallback
,
null
,
null
,
clientStream
);
null
,
null
,
clientStream
);
TcpClient
tunnelClient
=
tcpConnection
.
TcpClient
;
Stream
tunnelStream
=
tcpConnection
.
Stream
;
try
try
{
{
TcpClient
tunnelClient
=
tcpConnection
.
TcpClient
;
Stream
tunnelStream
=
tcpConnection
.
Stream
;
Task
sendRelay
;
Task
sendRelay
;
//Now async relay all server=>client & client=>server data
//Now async relay all server=>client & client=>server data
...
@@ -101,7 +100,7 @@ namespace Titanium.Web.Proxy.Helpers
...
@@ -101,7 +100,7 @@ namespace Titanium.Web.Proxy.Helpers
}
}
finally
finally
{
{
t
unnelStream
.
Dispose
();
t
cpConnection
.
Dispose
();
}
}
}
}
...
...
Titanium.Web.Proxy/Network/TcpConnection.cs
View file @
e1cf60d6
...
@@ -44,11 +44,15 @@ namespace Titanium.Web.Proxy.Network
...
@@ -44,11 +44,15 @@ namespace Titanium.Web.Proxy.Network
public
void
Dispose
()
public
void
Dispose
()
{
{
Stream
.
Dispose
();
TcpClient
.
LingerState
=
new
LingerOption
(
true
,
0
);
TcpClient
.
Client
.
Shutdown
(
SocketShutdown
.
Both
);
TcpClient
.
Client
.
Shutdown
(
SocketShutdown
.
Both
);
TcpClient
.
Client
.
Disconnect
(
true
);
TcpClient
.
Client
.
Close
(
);
TcpClient
.
Client
.
Dispose
();
TcpClient
.
Client
.
Dispose
();
Stream
.
Dispose
();
TcpClient
.
Close
();
}
}
}
}
}
}
Titanium.Web.Proxy/Network/TcpConnectionFactory.cs
View file @
e1cf60d6
...
@@ -120,6 +120,8 @@ namespace Titanium.Web.Proxy.Network
...
@@ -120,6 +120,8 @@ namespace Titanium.Web.Proxy.Network
stream
.
ReadTimeout
=
connectionTimeOutSeconds
*
1000
;
stream
.
ReadTimeout
=
connectionTimeOutSeconds
*
1000
;
stream
.
WriteTimeout
=
connectionTimeOutSeconds
*
1000
;
stream
.
WriteTimeout
=
connectionTimeOutSeconds
*
1000
;
client
.
NoDelay
=
true
;
return
new
TcpConnection
()
return
new
TcpConnection
()
{
{
HostName
=
remoteHostName
,
HostName
=
remoteHostName
,
...
...
Titanium.Web.Proxy/ProxyServer.cs
View file @
e1cf60d6
...
@@ -381,10 +381,14 @@ namespace Titanium.Web.Proxy
...
@@ -381,10 +381,14 @@ namespace Titanium.Web.Proxy
if
(
tcpClient
!=
null
)
if
(
tcpClient
!=
null
)
{
{
Task
.
Run
(
async
()
=>
Task
.
Run
(
async
()
=>
{
{
try
try
{
{
tcpClient
.
NoDelay
=
true
;
if
(
endPoint
.
GetType
()
==
typeof
(
TransparentProxyEndPoint
))
if
(
endPoint
.
GetType
()
==
typeof
(
TransparentProxyEndPoint
))
{
{
await
HandleClient
(
endPoint
as
TransparentProxyEndPoint
,
tcpClient
);
await
HandleClient
(
endPoint
as
TransparentProxyEndPoint
,
tcpClient
);
...
@@ -393,16 +397,18 @@ namespace Titanium.Web.Proxy
...
@@ -393,16 +397,18 @@ namespace Titanium.Web.Proxy
{
{
await
HandleClient
(
endPoint
as
ExplicitProxyEndPoint
,
tcpClient
);
await
HandleClient
(
endPoint
as
ExplicitProxyEndPoint
,
tcpClient
);
}
}
}
}
finally
finally
{
{
if
(
tcpClient
!=
null
)
if
(
tcpClient
!=
null
)
{
{
tcpClient
.
LingerState
=
new
LingerOption
(
true
,
0
);
tcpClient
.
Client
.
Shutdown
(
SocketShutdown
.
Both
);
tcpClient
.
Client
.
Shutdown
(
SocketShutdown
.
Both
);
tcpClient
.
Client
.
Disconnect
(
true
);
tcpClient
.
Client
.
Close
(
);
tcpClient
.
Client
.
Dispose
();
tcpClient
.
Client
.
Dispose
();
tcpClient
.
Close
();
}
}
}
}
});
});
...
...
Titanium.Web.Proxy/ResponseHandler.cs
View file @
e1cf60d6
using
System
;
using
System
;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
System.IO
;
using
System.IO
;
using
System.Linq
;
using
System.Net.Sockets
;
using
Titanium.Web.Proxy.EventArguments
;
using
Titanium.Web.Proxy.EventArguments
;
using
Titanium.Web.Proxy.Models
;
using
Titanium.Web.Proxy.Models
;
using
Titanium.Web.Proxy.Compression
;
using
Titanium.Web.Proxy.Compression
;
...
...
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