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
5e4c5f41
Commit
5e4c5f41
authored
May 15, 2018
by
justcoding121
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor
parent
fc3a9308
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
19 additions
and
23 deletions
+19
-23
ExplicitClientHandler.cs
Titanium.Web.Proxy/ExplicitClientHandler.cs
+9
-6
ProxyServer.cs
Titanium.Web.Proxy/ProxyServer.cs
+2
-2
RequestHandler.cs
Titanium.Web.Proxy/RequestHandler.cs
+5
-14
TransparentClientHandler.cs
Titanium.Web.Proxy/TransparentClientHandler.cs
+3
-1
No files found.
Titanium.Web.Proxy/ExplicitClientHandler.cs
View file @
5e4c5f41
...
...
@@ -150,8 +150,11 @@ namespace Titanium.Web.Proxy
}
SslStream
sslStream
=
null
;
//don't pass cancellation token here
//it could cause floating server connections when client exits
prefetchConnectionTask
=
getServerConnection
(
connectArgs
,
true
,
null
,
false
,
cancellationToken
);
null
,
false
,
CancellationToken
.
None
);
try
{
sslStream
=
new
SslStream
(
clientStream
);
...
...
@@ -333,17 +336,17 @@ namespace Titanium.Web.Proxy
{
clientStream
.
Dispose
();
if
(!
cancellationTokenSource
.
IsCancellationRequested
)
{
cancellationTokenSource
.
Cancel
();
}
if
(!
calledRequestHandler
&&
prefetchConnectionTask
!=
null
)
{
var
connection
=
await
prefetchConnectionTask
;
await
tcpConnectionFactory
.
Release
(
connection
,
closeServerConnection
);
}
if
(!
cancellationTokenSource
.
IsCancellationRequested
)
{
cancellationTokenSource
.
Cancel
();
}
}
}
}
...
...
Titanium.Web.Proxy/ProxyServer.cs
View file @
5e4c5f41
...
...
@@ -815,12 +815,12 @@ namespace Titanium.Web.Proxy
.
RetryAsync
(
retries
,
onRetryAsync
:
async
(
ex
,
i
,
context
)
=>
{
if
(
context
.
ContainsKey
(
"connection"
)
)
if
(
context
[
"connection"
]
!=
null
)
{
//close connection on error
var
connection
=
(
TcpServerConnection
)
context
[
"connection"
];
await
tcpConnectionFactory
.
Release
(
connection
,
true
);
context
.
Remove
(
"connection"
)
;
context
[
"connection"
]
=
null
;
}
});
...
...
Titanium.Web.Proxy/RequestHandler.cs
View file @
5e4c5f41
...
...
@@ -204,21 +204,13 @@ namespace Titanium.Web.Proxy
connection
=
null
;
}
var
contextData
=
new
Dictionary
<
string
,
object
>();
if
(
connection
!=
null
)
{
contextData
.
Add
(
"connection"
,
connection
);
}
//for connection pool retry fails until cache is exhausted
await
retryPolicy
<
ServerConnectionException
>().
ExecuteAsync
(
async
(
context
)
=>
{
connection
=
context
.
ContainsKey
(
"connection"
)?
(
TcpServerConnection
)
context
[
"connection"
]
:
await
getServerConnection
(
args
,
false
,
clientConnection
.
NegotiatedApplicationProtocol
,
false
,
cancellationToken
);
connection
=
context
[
"connection"
]
as
TcpServerConnection
??
await
getServerConnection
(
args
,
false
,
clientConnection
.
NegotiatedApplicationProtocol
,
false
,
cancellationToken
);
context
[
"connection"
]
=
connection
;
...
...
@@ -235,8 +227,7 @@ namespace Titanium.Web.Proxy
// construct the web request that we are going to issue on behalf of the client.
await
handleHttpSessionRequestInternal
(
connection
,
args
);
},
contextData
);
},
new
Dictionary
<
string
,
object
>
{
{
"connection"
,
connection
}
});
//user requested
if
(
args
.
WebSession
.
CloseServerConnection
)
...
...
Titanium.Web.Proxy/TransparentClientHandler.cs
View file @
5e4c5f41
...
...
@@ -63,9 +63,11 @@ namespace Titanium.Web.Proxy
if
(
endPoint
.
DecryptSsl
&&
args
.
DecryptSsl
)
{
//don't pass cancellation token here
//it could cause floating server connections when client exits
prefetchConnectionTask
=
tcpConnectionFactory
.
GetClient
(
httpsHostName
,
endPoint
.
Port
,
null
,
true
,
null
,
false
,
this
,
UpStreamEndPoint
,
UpStreamHttpsProxy
,
false
,
cancellationToken
);
UpStreamEndPoint
,
UpStreamHttpsProxy
,
false
,
CancellationToken
.
None
);
SslStream
sslStream
=
null
;
...
...
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