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
c47e7d82
Commit
c47e7d82
authored
Jan 04, 2016
by
titanium007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use connection wisely
parent
ec0d99bb
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
3 deletions
+7
-3
RequestHandler.cs
Titanium.Web.Proxy/RequestHandler.cs
+7
-3
No files found.
Titanium.Web.Proxy/RequestHandler.cs
View file @
c47e7d82
...
...
@@ -115,6 +115,7 @@ namespace Titanium.Web.Proxy
private
static
void
HandleHttpSessionRequest
(
TcpClient
client
,
string
httpCmd
,
Stream
clientStream
,
CustomBinaryReader
clientStreamReader
,
StreamWriter
clientStreamWriter
,
string
secureTunnelHostName
)
{
TcpConnection
connection
=
null
;
while
(
true
)
{
if
(
string
.
IsNullOrEmpty
(
httpCmd
))
...
...
@@ -219,7 +220,7 @@ namespace Titanium.Web.Proxy
SetRequestHeaders
(
args
.
ProxySession
.
Request
.
RequestHeaders
,
args
.
ProxySession
);
//construct the web request that we are going to issue on behalf of the client.
var
connection
=
TcpConnectionManager
.
GetClient
(
args
.
ProxySession
.
Request
.
RequestUri
.
Host
,
args
.
ProxySession
.
Request
.
RequestUri
.
Port
,
args
.
IsHttps
)
;
connection
=
connection
==
null
?
TcpConnectionManager
.
GetClient
(
args
.
ProxySession
.
Request
.
RequestUri
.
Host
,
args
.
ProxySession
.
Request
.
RequestUri
.
Port
,
args
.
IsHttps
):
connection
;
args
.
ProxySession
.
SetConnection
(
connection
);
args
.
ProxySession
.
SendRequest
();
...
...
@@ -247,7 +248,7 @@ namespace Titanium.Web.Proxy
Dispose
(
client
,
clientStream
,
clientStreamReader
,
clientStreamWriter
,
args
);
return
;
}
args
.
ProxySession
.
ProxyClient
.
Client
.
Close
();
//
args.ProxySession.ProxyClient.Client.Close();
// if (args.ProxySession.ProxyClient.Client.Connected)
// TcpConnectionManager.AddClient(args.ProxySession.Request.RequestUri.Host, args.ProxySession.Request.RequestUri.Port, args.IsHttps, args.ProxySession.ProxyClient);
...
...
@@ -258,9 +259,12 @@ namespace Titanium.Web.Proxy
catch
{
Dispose
(
client
,
clientStream
,
clientStreamReader
,
clientStreamWriter
,
args
);
return
;
break
;
}
}
if
(
connection
!=
null
)
connection
.
Client
.
Close
();
}
private
static
void
WriteConnectResponse
(
StreamWriter
clientStreamWriter
,
string
httpVersion
)
...
...
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