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
92fa402d
Commit
92fa402d
authored
Feb 14, 2019
by
justcoding121
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
move sslstream dispose to end to be safe
parent
0f910b1a
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
14 deletions
+9
-14
ExplicitClientHandler.cs
src/Titanium.Web.Proxy/ExplicitClientHandler.cs
+4
-7
TransparentClientHandler.cs
src/Titanium.Web.Proxy/TransparentClientHandler.cs
+5
-7
No files found.
src/Titanium.Web.Proxy/ExplicitClientHandler.cs
View file @
92fa402d
...
...
@@ -41,6 +41,8 @@ namespace Titanium.Web.Proxy
bool
closeServerConnection
=
false
;
bool
calledRequestHandler
=
false
;
SslStream
sslStream
=
null
;
try
{
string
connectHostname
=
null
;
...
...
@@ -150,8 +152,6 @@ namespace Titanium.Web.Proxy
await
tcpConnectionFactory
.
Release
(
connection
,
true
);
}
SslStream
sslStream
=
null
;
if
(
EnableTcpServerConnectionPrefetch
)
{
//don't pass cancellation token here
...
...
@@ -201,10 +201,6 @@ namespace Titanium.Web.Proxy
throw
new
ProxyConnectException
(
$"Couldn't authenticate host '
{
connectHostname
}
' with certificate '
{
certname
}
'."
,
e
,
connectArgs
);
}
finally
{
sslStream
?.
Dispose
();
}
if
(
await
HttpHelper
.
IsConnectMethod
(
clientStream
)
==
-
1
)
{
...
...
@@ -354,6 +350,7 @@ namespace Titanium.Web.Proxy
await
tcpConnectionFactory
.
Release
(
prefetchConnectionTask
,
closeServerConnection
);
}
sslStream
?.
Dispose
();
clientStream
.
Dispose
();
if
(!
cancellationTokenSource
.
IsCancellationRequested
)
...
...
src/Titanium.Web.Proxy/TransparentClientHandler.cs
View file @
92fa402d
...
...
@@ -35,6 +35,8 @@ namespace Titanium.Web.Proxy
var
clientStream
=
new
CustomBufferedStream
(
clientConnection
.
GetStream
(),
BufferPool
,
BufferSize
);
var
clientStreamWriter
=
new
HttpResponseWriter
(
clientStream
,
BufferPool
,
BufferSize
);
SslStream
sslStream
=
null
;
try
{
var
clientHelloInfo
=
await
SslTools
.
PeekClientHello
(
clientStream
,
BufferPool
,
cancellationToken
);
...
...
@@ -61,8 +63,6 @@ namespace Titanium.Web.Proxy
if
(
endPoint
.
DecryptSsl
&&
args
.
DecryptSsl
)
{
SslStream
sslStream
=
null
;
//do client authentication using certificate
X509Certificate2
certificate
=
null
;
try
...
...
@@ -92,10 +92,7 @@ namespace Titanium.Web.Proxy
throw
new
ProxyConnectException
(
$"Couldn't authenticate host '
{
httpsHostName
}
' with certificate '
{
certname
}
'."
,
e
,
session
);
}
finally
{
sslStream
?.
Dispose
();
}
}
else
{
...
...
@@ -161,6 +158,7 @@ namespace Titanium.Web.Proxy
}
finally
{
sslStream
?.
Dispose
();
clientStream
.
Dispose
();
if
(!
cancellationTokenSource
.
IsCancellationRequested
)
...
...
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