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
4aad40e9
Commit
4aad40e9
authored
May 24, 2017
by
justcoding121
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use existing connection for websocket upgrade if available
parent
c60ab7ca
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
8 deletions
+29
-8
Tcp.cs
Titanium.Web.Proxy/Helpers/Tcp.cs
+28
-7
RequestHandler.cs
Titanium.Web.Proxy/RequestHandler.cs
+1
-1
No files found.
Titanium.Web.Proxy/Helpers/Tcp.cs
View file @
4aad40e9
...
...
@@ -179,12 +179,14 @@ namespace Titanium.Web.Proxy.Helpers
/// <param name="isHttps"></param>
/// <param name="clientStream"></param>
/// <param name="tcpConnectionFactory"></param>
/// <param name="connection"></param>
/// <returns></returns>
internal
static
async
Task
SendRaw
(
ProxyServer
server
,
string
remoteHostName
,
int
remotePort
,
string
httpCmd
,
Version
httpVersion
,
Dictionary
<
string
,
HttpHeader
>
requestHeaders
,
bool
isHttps
,
Stream
clientStream
,
TcpConnectionFactory
tcpConnectionFactory
)
Stream
clientStream
,
TcpConnectionFactory
tcpConnectionFactory
,
TcpConnection
connection
=
null
)
{
//prepare the prefix content
StringBuilder
sb
=
null
;
...
...
@@ -210,10 +212,23 @@ namespace Titanium.Web.Proxy.Helpers
sb
.
Append
(
ProxyConstants
.
NewLine
);
}
var
tcpConnection
=
await
tcpConnectionFactory
.
CreateClient
(
server
,
remoteHostName
,
remotePort
,
httpVersion
,
isHttps
,
null
,
null
);
bool
connectionCreated
=
false
;
TcpConnection
tcpConnection
;
//create new connection if connection is null
if
(
connection
==
null
)
{
tcpConnection
=
await
tcpConnectionFactory
.
CreateClient
(
server
,
remoteHostName
,
remotePort
,
httpVersion
,
isHttps
,
null
,
null
);
connectionCreated
=
true
;
}
else
{
tcpConnection
=
connection
;
}
try
{
...
...
@@ -228,8 +243,14 @@ namespace Titanium.Web.Proxy.Helpers
}
finally
{
tcpConnection
.
Dispose
();
Interlocked
.
Decrement
(
ref
server
.
serverConnectionCount
);
//if connection was null
//then a new connection was created
//so dispose the new connection
if
(
connectionCreated
)
{
tcpConnection
.
Dispose
();
Interlocked
.
Decrement
(
ref
server
.
serverConnectionCount
);
}
}
}
}
...
...
Titanium.Web.Proxy/RequestHandler.cs
View file @
4aad40e9
...
...
@@ -334,7 +334,7 @@ namespace Titanium.Web.Proxy
await
TcpHelper
.
SendRaw
(
this
,
httpRemoteUri
.
Host
,
httpRemoteUri
.
Port
,
httpCmd
,
httpVersion
,
args
.
WebSession
.
Request
.
RequestHeaders
,
args
.
IsHttps
,
clientStream
,
tcpConnectionFactory
);
clientStream
,
tcpConnectionFactory
,
connection
);
args
.
Dispose
();
break
;
...
...
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