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
12814410
Commit
12814410
authored
Oct 20, 2016
by
Hakan Arıcı
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Tabs are fixed as spaces.
parent
0b186431
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
15 deletions
+15
-15
HttpWebClient.cs
Titanium.Web.Proxy/Http/HttpWebClient.cs
+3
-3
RequestHandler.cs
Titanium.Web.Proxy/RequestHandler.cs
+12
-12
No files found.
Titanium.Web.Proxy/Http/HttpWebClient.cs
View file @
12814410
...
...
@@ -39,7 +39,7 @@ namespace Titanium.Web.Proxy.Http
/// </summary>
public
bool
IsHttps
=>
this
.
Request
.
RequestUri
.
Scheme
==
Uri
.
UriSchemeHttps
;
/// <summary>
/// <summary>
/// Set the tcp connection to server used by this webclient
/// </summary>
/// <param name="connection">Instance of <see cref="TcpConnection"/></param>
...
...
@@ -209,9 +209,9 @@ namespace Titanium.Web.Proxy.Http
{
var
existing
=
Response
.
ResponseHeaders
[
newHeader
.
Name
];
var
nonUniqueHeaders
=
new
List
<
HttpHeader
>
{
existing
,
newHeader
};
var
nonUniqueHeaders
=
new
List
<
HttpHeader
>
{
existing
,
newHeader
};
Response
.
NonUniqueResponseHeaders
.
Add
(
newHeader
.
Name
,
nonUniqueHeaders
);
Response
.
NonUniqueResponseHeaders
.
Add
(
newHeader
.
Name
,
nonUniqueHeaders
);
Response
.
ResponseHeaders
.
Remove
(
newHeader
.
Name
);
}
//add to unique header collection
...
...
Titanium.Web.Proxy/RequestHandler.cs
View file @
12814410
...
...
@@ -30,12 +30,12 @@ namespace Titanium.Web.Proxy
//So for HTTPS requests client would send CONNECT header to negotiate a secure tcp tunnel via proxy
private
async
Task
HandleClient
(
ExplicitProxyEndPoint
endPoint
,
TcpClient
tcpClient
)
{
var
tcpRow
=
TcpHelper
.
GetExtendedTcpTable
().
FirstOrDefault
(
row
=>
row
.
LocalEndPoint
.
Port
==
((
IPEndPoint
)
tcpClient
.
Client
.
RemoteEndPoint
).
Port
);
var
tcpRow
=
TcpHelper
.
GetExtendedTcpTable
().
FirstOrDefault
(
row
=>
row
.
LocalEndPoint
.
Port
==
((
IPEndPoint
)
tcpClient
.
Client
.
RemoteEndPoint
).
Port
);
var
processId
=
tcpRow
?.
ProcessId
??
0
;
var
processId
=
tcpRow
?.
ProcessId
??
0
;
Stream
clientStream
=
tcpClient
.
GetStream
();
Stream
clientStream
=
tcpClient
.
GetStream
();
clientStream
.
ReadTimeout
=
ConnectionTimeOutSeconds
*
1000
;
clientStream
.
WriteTimeout
=
ConnectionTimeOutSeconds
*
1000
;
...
...
@@ -175,12 +175,12 @@ namespace Titanium.Web.Proxy
//So for HTTPS requests we would start SSL negotiation right away without expecting a CONNECT request from client
private
async
Task
HandleClient
(
TransparentProxyEndPoint
endPoint
,
TcpClient
tcpClient
)
{
var
tcpRow
=
TcpHelper
.
GetExtendedTcpTable
().
FirstOrDefault
(
row
=>
row
.
LocalEndPoint
.
Port
==
((
IPEndPoint
)
tcpClient
.
Client
.
RemoteEndPoint
).
Port
);
var
tcpRow
=
TcpHelper
.
GetExtendedTcpTable
().
FirstOrDefault
(
row
=>
row
.
LocalEndPoint
.
Port
==
((
IPEndPoint
)
tcpClient
.
Client
.
RemoteEndPoint
).
Port
);
var
processId
=
tcpRow
?.
ProcessId
??
0
;
var
processId
=
tcpRow
?.
ProcessId
??
0
;
Stream
clientStream
=
tcpClient
.
GetStream
();
Stream
clientStream
=
tcpClient
.
GetStream
();
clientStream
.
ReadTimeout
=
ConnectionTimeOutSeconds
*
1000
;
clientStream
.
WriteTimeout
=
ConnectionTimeOutSeconds
*
1000
;
...
...
@@ -209,9 +209,9 @@ namespace Titanium.Web.Proxy
}
catch
(
Exception
)
{
sslStream
.
Dispose
();
sslStream
.
Dispose
();
Dispose
(
sslStream
,
clientStreamReader
,
clientStreamWriter
,
null
);
Dispose
(
sslStream
,
clientStreamReader
,
clientStreamWriter
,
null
);
return
;
}
clientStream
=
sslStream
;
...
...
@@ -386,9 +386,9 @@ namespace Titanium.Web.Proxy
var
args
=
new
SessionEventArgs
(
BUFFER_SIZE
,
HandleHttpSessionResponse
);
args
.
ProxyClient
.
TcpClient
=
client
;
args
.
WebSession
.
ConnectHeaders
=
connectHeaders
;
args
.
WebSession
.
ProcessId
=
processId
;
args
.
WebSession
.
ProcessId
=
processId
;
try
try
{
//break up the line into three components (method, remote URL & Http Version)
var
httpCmdSplit
=
httpCmd
.
Split
(
ProxyConstants
.
SpaceSplit
,
3
);
...
...
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