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
464e7c95
Commit
464e7c95
authored
Jul 18, 2017
by
justcoding121
Committed by
justcoding121
Jul 18, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix UpstreamEndpoint override
parent
f37e85f0
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
14 additions
and
13 deletions
+14
-13
SessionEventArgs.cs
Titanium.Web.Proxy/EventArguments/SessionEventArgs.cs
+2
-2
TunnelConnectEventArgs.cs
Titanium.Web.Proxy/EventArguments/TunnelConnectEventArgs.cs
+2
-2
HttpWebClient.cs
Titanium.Web.Proxy/Http/HttpWebClient.cs
+1
-2
TcpConnectionFactory.cs
Titanium.Web.Proxy/Network/Tcp/TcpConnectionFactory.cs
+2
-1
RequestHandler.cs
Titanium.Web.Proxy/RequestHandler.cs
+7
-6
No files found.
Titanium.Web.Proxy/EventArguments/SessionEventArgs.cs
View file @
464e7c95
...
@@ -99,14 +99,14 @@ namespace Titanium.Web.Proxy.EventArguments
...
@@ -99,14 +99,14 @@ namespace Titanium.Web.Proxy.EventArguments
/// Constructor to initialize the proxy
/// Constructor to initialize the proxy
/// </summary>
/// </summary>
internal
SessionEventArgs
(
int
bufferSize
,
internal
SessionEventArgs
(
int
bufferSize
,
ProxyEndPoint
endPoint
,
IPEndPoint
upStreamEndPoint
,
ProxyEndPoint
endPoint
,
Func
<
SessionEventArgs
,
Task
>
httpResponseHandler
)
Func
<
SessionEventArgs
,
Task
>
httpResponseHandler
)
{
{
this
.
bufferSize
=
bufferSize
;
this
.
bufferSize
=
bufferSize
;
this
.
httpResponseHandler
=
httpResponseHandler
;
this
.
httpResponseHandler
=
httpResponseHandler
;
ProxyClient
=
new
ProxyClient
();
ProxyClient
=
new
ProxyClient
();
WebSession
=
new
HttpWebClient
(
bufferSize
,
upStreamEndPoint
);
WebSession
=
new
HttpWebClient
(
bufferSize
);
WebSession
.
ProcessId
=
new
Lazy
<
int
>(()
=>
WebSession
.
ProcessId
=
new
Lazy
<
int
>(()
=>
{
{
...
...
Titanium.Web.Proxy/EventArguments/TunnelConnectEventArgs.cs
View file @
464e7c95
...
@@ -7,8 +7,8 @@ namespace Titanium.Web.Proxy.EventArguments
...
@@ -7,8 +7,8 @@ namespace Titanium.Web.Proxy.EventArguments
{
{
public
bool
IsHttpsConnect
{
get
;
set
;
}
public
bool
IsHttpsConnect
{
get
;
set
;
}
public
TunnelConnectSessionEventArgs
(
int
bufferSize
,
ProxyEndPoint
endPoint
,
IPEndPoint
upStreamEndPoint
)
public
TunnelConnectSessionEventArgs
(
int
bufferSize
,
ProxyEndPoint
endPoint
)
:
base
(
bufferSize
,
endPoint
,
upStreamEndPoint
,
null
)
:
base
(
bufferSize
,
endPoint
,
null
)
{
{
}
}
...
...
Titanium.Web.Proxy/Http/HttpWebClient.cs
View file @
464e7c95
...
@@ -56,10 +56,9 @@ namespace Titanium.Web.Proxy.Http
...
@@ -56,10 +56,9 @@ namespace Titanium.Web.Proxy.Http
/// </summary>
/// </summary>
public
bool
IsHttps
=>
Request
.
IsHttps
;
public
bool
IsHttps
=>
Request
.
IsHttps
;
internal
HttpWebClient
(
int
bufferSize
,
IPEndPoint
upStreamEndPoint
)
internal
HttpWebClient
(
int
bufferSize
)
{
{
this
.
bufferSize
=
bufferSize
;
this
.
bufferSize
=
bufferSize
;
UpStreamEndPoint
=
upStreamEndPoint
;
RequestId
=
Guid
.
NewGuid
();
RequestId
=
Guid
.
NewGuid
();
Request
=
new
Request
();
Request
=
new
Request
();
...
...
Titanium.Web.Proxy/Network/Tcp/TcpConnectionFactory.cs
View file @
464e7c95
...
@@ -55,7 +55,7 @@ namespace Titanium.Web.Proxy.Network.Tcp
...
@@ -55,7 +55,7 @@ namespace Titanium.Web.Proxy.Network.Tcp
try
try
{
{
#if NET45
#if NET45
client
=
new
TcpClient
(
upStreamEndPoint
??
server
.
UpStreamEndPoint
);
client
=
new
TcpClient
(
upStreamEndPoint
);
#else
#else
client
=
new
TcpClient
();
client
=
new
TcpClient
();
client
.
Client
.
Bind
(
server
.
UpStreamEndPoint
);
client
.
Client
.
Bind
(
server
.
UpStreamEndPoint
);
...
@@ -131,6 +131,7 @@ namespace Titanium.Web.Proxy.Network.Tcp
...
@@ -131,6 +131,7 @@ namespace Titanium.Web.Proxy.Network.Tcp
{
{
UpStreamHttpProxy
=
externalHttpProxy
,
UpStreamHttpProxy
=
externalHttpProxy
,
UpStreamHttpsProxy
=
externalHttpsProxy
,
UpStreamHttpsProxy
=
externalHttpsProxy
,
UpStreamEndPoint
=
upStreamEndPoint
,
HostName
=
remoteHostName
,
HostName
=
remoteHostName
,
Port
=
remotePort
,
Port
=
remotePort
,
IsHttps
=
isHttps
,
IsHttps
=
isHttps
,
...
...
Titanium.Web.Proxy/RequestHandler.cs
View file @
464e7c95
...
@@ -86,7 +86,7 @@ namespace Titanium.Web.Proxy
...
@@ -86,7 +86,7 @@ namespace Titanium.Web.Proxy
await
HeaderParser
.
ReadHeaders
(
clientStreamReader
,
connectRequest
.
RequestHeaders
);
await
HeaderParser
.
ReadHeaders
(
clientStreamReader
,
connectRequest
.
RequestHeaders
);
var
connectArgs
=
new
TunnelConnectSessionEventArgs
(
BufferSize
,
endPoint
,
UpStreamEndPoint
);
var
connectArgs
=
new
TunnelConnectSessionEventArgs
(
BufferSize
,
endPoint
);
connectArgs
.
WebSession
.
Request
=
connectRequest
;
connectArgs
.
WebSession
.
Request
=
connectRequest
;
connectArgs
.
ProxyClient
.
TcpClient
=
tcpClient
;
connectArgs
.
ProxyClient
.
TcpClient
=
tcpClient
;
connectArgs
.
ProxyClient
.
ClientStream
=
clientStream
;
connectArgs
.
ProxyClient
.
ClientStream
=
clientStream
;
...
@@ -293,7 +293,7 @@ namespace Titanium.Web.Proxy
...
@@ -293,7 +293,7 @@ namespace Titanium.Web.Proxy
break
;
break
;
}
}
var
args
=
new
SessionEventArgs
(
BufferSize
,
endPoint
,
UpStreamEndPoint
,
HandleHttpSessionResponse
)
var
args
=
new
SessionEventArgs
(
BufferSize
,
endPoint
,
HandleHttpSessionResponse
)
{
{
ProxyClient
=
{
TcpClient
=
client
},
ProxyClient
=
{
TcpClient
=
client
},
WebSession
=
{
ConnectRequest
=
connectRequest
}
WebSession
=
{
ConnectRequest
=
connectRequest
}
...
@@ -355,9 +355,10 @@ namespace Titanium.Web.Proxy
...
@@ -355,9 +355,10 @@ namespace Titanium.Web.Proxy
}
}
//create a new connection if hostname/upstream end point changes
//create a new connection if hostname/upstream end point changes
if
(
connection
!=
null
if
(
connection
!=
null
&&
(!
connection
.
HostName
.
Equals
(
args
.
WebSession
.
Request
.
RequestUri
.
Host
,
StringComparison
.
OrdinalIgnoreCase
)
&&
(!
connection
.
HostName
.
Equals
(
args
.
WebSession
.
Request
.
RequestUri
.
Host
,
StringComparison
.
OrdinalIgnoreCase
)
||
args
.
WebSession
.
UpStreamEndPoint
!=
connection
.
UpStreamEndPoint
))
||
(
args
.
WebSession
.
UpStreamEndPoint
!=
null
&&
!
args
.
WebSession
.
UpStreamEndPoint
.
Equals
(
connection
.
UpStreamEndPoint
))))
{
{
connection
.
Dispose
();
connection
.
Dispose
();
UpdateServerConnectionCount
(
false
);
UpdateServerConnectionCount
(
false
);
...
@@ -573,7 +574,7 @@ namespace Titanium.Web.Proxy
...
@@ -573,7 +574,7 @@ namespace Titanium.Web.Proxy
/// <param name="args"></param>
/// <param name="args"></param>
/// <param name="isConnect"></param>
/// <param name="isConnect"></param>
/// <returns></returns>
/// <returns></returns>
private
async
Task
<
TcpConnection
>
GetServerConnection
(
SessionEventArgs
args
,
bool
isConnect
)
private
async
Task
<
TcpConnection
>
GetServerConnection
(
SessionEventArgs
args
,
bool
isConnect
)
{
{
ExternalProxy
customUpStreamHttpProxy
=
null
;
ExternalProxy
customUpStreamHttpProxy
=
null
;
ExternalProxy
customUpStreamHttpsProxy
=
null
;
ExternalProxy
customUpStreamHttpsProxy
=
null
;
...
@@ -601,7 +602,7 @@ namespace Titanium.Web.Proxy
...
@@ -601,7 +602,7 @@ namespace Titanium.Web.Proxy
args
.
WebSession
.
Request
.
RequestUri
.
Port
,
args
.
WebSession
.
Request
.
RequestUri
.
Port
,
args
.
WebSession
.
Request
.
HttpVersion
,
args
.
WebSession
.
Request
.
HttpVersion
,
args
.
IsHttps
,
isConnect
,
args
.
IsHttps
,
isConnect
,
args
.
WebSession
.
UpStreamEndPoint
,
args
.
WebSession
.
UpStreamEndPoint
??
UpStreamEndPoint
,
customUpStreamHttpProxy
??
UpStreamHttpProxy
,
customUpStreamHttpProxy
??
UpStreamHttpProxy
,
customUpStreamHttpsProxy
??
UpStreamHttpsProxy
);
customUpStreamHttpsProxy
??
UpStreamHttpsProxy
);
}
}
...
...
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