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
53b77f53
Commit
53b77f53
authored
May 17, 2018
by
justcoding121
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
used named params for readability
parent
d6fa5d60
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
15 deletions
+20
-15
ExplicitClientHandler.cs
Titanium.Web.Proxy/ExplicitClientHandler.cs
+11
-8
RequestHandler.cs
Titanium.Web.Proxy/RequestHandler.cs
+3
-3
TransparentClientHandler.cs
Titanium.Web.Proxy/TransparentClientHandler.cs
+6
-4
No files found.
Titanium.Web.Proxy/ExplicitClientHandler.cs
View file @
53b77f53
...
@@ -140,8 +140,9 @@ namespace Titanium.Web.Proxy
...
@@ -140,8 +140,9 @@ namespace Titanium.Web.Proxy
{
{
// test server HTTP/2 support
// test server HTTP/2 support
// todo: this is a hack, because Titanium does not support HTTP protocol changing currently
// todo: this is a hack, because Titanium does not support HTTP protocol changing currently
var
connection
=
await
tcpConnectionFactory
.
GetServerConnection
(
this
,
connectArgs
,
true
,
var
connection
=
await
tcpConnectionFactory
.
GetServerConnection
(
this
,
connectArgs
,
SslExtensions
.
Http2ProtocolAsList
,
true
,
cancellationToken
);
isConnect
:
true
,
applicationProtocols
:
SslExtensions
.
Http2ProtocolAsList
,
noCache
:
true
,
cancellationToken
:
cancellationToken
);
http2Supported
=
connection
.
NegotiatedApplicationProtocol
==
SslApplicationProtocol
.
Http2
;
http2Supported
=
connection
.
NegotiatedApplicationProtocol
==
SslApplicationProtocol
.
Http2
;
...
@@ -153,8 +154,9 @@ namespace Titanium.Web.Proxy
...
@@ -153,8 +154,9 @@ namespace Titanium.Web.Proxy
//don't pass cancellation token here
//don't pass cancellation token here
//it could cause floating server connections when client exits
//it could cause floating server connections when client exits
prefetchConnectionTask
=
tcpConnectionFactory
.
GetServerConnection
(
this
,
connectArgs
,
true
,
prefetchConnectionTask
=
tcpConnectionFactory
.
GetServerConnection
(
this
,
connectArgs
,
null
,
false
,
CancellationToken
.
None
);
isConnect
:
true
,
applicationProtocols
:
null
,
noCache
:
false
,
cancellationToken
:
CancellationToken
.
None
);
try
try
{
{
...
@@ -215,7 +217,8 @@ namespace Titanium.Web.Proxy
...
@@ -215,7 +217,8 @@ namespace Titanium.Web.Proxy
// If we detected that client tunnel CONNECTs without SSL by checking for empty client hello then
// If we detected that client tunnel CONNECTs without SSL by checking for empty client hello then
// this connection should not be HTTPS.
// this connection should not be HTTPS.
var
connection
=
await
tcpConnectionFactory
.
GetServerConnection
(
this
,
connectArgs
,
var
connection
=
await
tcpConnectionFactory
.
GetServerConnection
(
this
,
connectArgs
,
true
,
SslExtensions
.
Http2ProtocolAsList
,
true
,
cancellationToken
);
isConnect
:
true
,
applicationProtocols
:
SslExtensions
.
Http2ProtocolAsList
,
noCache
:
true
,
cancellationToken
:
cancellationToken
);
try
try
{
{
...
@@ -284,9 +287,9 @@ namespace Titanium.Web.Proxy
...
@@ -284,9 +287,9 @@ namespace Titanium.Web.Proxy
throw
new
Exception
(
$"HTTP/2 Protocol violation. Empty string expected, '
{
line
}
' received"
);
throw
new
Exception
(
$"HTTP/2 Protocol violation. Empty string expected, '
{
line
}
' received"
);
}
}
var
connection
=
await
tcpConnectionFactory
.
GetServerConnection
(
this
,
connectArgs
,
true
,
var
connection
=
await
tcpConnectionFactory
.
GetServerConnection
(
this
,
connectArgs
,
SslExtensions
.
Http2ProtocolAsList
,
true
,
isConnect
:
true
,
applicationProtocols
:
SslExtensions
.
Http2ProtocolAsList
,
cancellationToken
);
noCache
:
true
,
cancellationToken
:
cancellationToken
);
try
try
{
{
await
connection
.
StreamWriter
.
WriteLineAsync
(
"PRI * HTTP/2.0"
,
cancellationToken
);
await
connection
.
StreamWriter
.
WriteLineAsync
(
"PRI * HTTP/2.0"
,
cancellationToken
);
...
...
Titanium.Web.Proxy/RequestHandler.cs
View file @
53b77f53
...
@@ -206,9 +206,9 @@ namespace Titanium.Web.Proxy
...
@@ -206,9 +206,9 @@ namespace Titanium.Web.Proxy
//a connection generator task with captured parameters via closure.
//a connection generator task with captured parameters via closure.
Func
<
Task
<
TcpServerConnection
>>
generator
=
()
=>
Func
<
Task
<
TcpServerConnection
>>
generator
=
()
=>
tcpConnectionFactory
.
GetServerConnection
(
this
,
args
,
false
,
tcpConnectionFactory
.
GetServerConnection
(
this
,
args
,
isConnect
:
false
,
clientConnection
.
NegotiatedApplicationProtocol
,
applicationProtocol
:
clientConnection
.
NegotiatedApplicationProtocol
,
false
,
cancellationToken
);
noCache
:
false
,
cancellationToken
:
cancellationToken
);
//for connection pool, retry fails until cache is exhausted.
//for connection pool, retry fails until cache is exhausted.
await
retryPolicy
<
ServerConnectionException
>().
ExecuteAsync
(
async
(
serverConnection
)
=>
await
retryPolicy
<
ServerConnectionException
>().
ExecuteAsync
(
async
(
serverConnection
)
=>
...
...
Titanium.Web.Proxy/TransparentClientHandler.cs
View file @
53b77f53
...
@@ -66,8 +66,9 @@ namespace Titanium.Web.Proxy
...
@@ -66,8 +66,9 @@ namespace Titanium.Web.Proxy
//don't pass cancellation token here
//don't pass cancellation token here
//it could cause floating server connections when client exits
//it could cause floating server connections when client exits
prefetchConnectionTask
=
tcpConnectionFactory
.
GetServerConnection
(
httpsHostName
,
endPoint
.
Port
,
prefetchConnectionTask
=
tcpConnectionFactory
.
GetServerConnection
(
httpsHostName
,
endPoint
.
Port
,
null
,
true
,
null
,
false
,
this
,
httpVersion
:
null
,
isHttps
:
true
,
applicationProtocols
:
null
,
isConnect
:
false
,
UpStreamEndPoint
,
UpStreamHttpsProxy
,
false
,
CancellationToken
.
None
);
proxyServer
:
this
,
upStreamEndPoint
:
UpStreamEndPoint
,
externalProxy
:
UpStreamHttpsProxy
,
noCache
:
false
,
cancellationToken
:
CancellationToken
.
None
);
SslStream
sslStream
=
null
;
SslStream
sslStream
=
null
;
...
@@ -97,8 +98,9 @@ namespace Titanium.Web.Proxy
...
@@ -97,8 +98,9 @@ namespace Titanium.Web.Proxy
else
else
{
{
var
connection
=
await
tcpConnectionFactory
.
GetServerConnection
(
httpsHostName
,
endPoint
.
Port
,
var
connection
=
await
tcpConnectionFactory
.
GetServerConnection
(
httpsHostName
,
endPoint
.
Port
,
null
,
false
,
null
,
httpVersion
:
null
,
isHttps
:
false
,
applicationProtocols
:
null
,
true
,
this
,
UpStreamEndPoint
,
UpStreamHttpsProxy
,
true
,
cancellationToken
);
isConnect
:
true
,
proxyServer
:
this
,
upStreamEndPoint
:
UpStreamEndPoint
,
externalProxy
:
UpStreamHttpsProxy
,
noCache
:
true
,
cancellationToken
:
cancellationToken
);
try
try
{
{
...
...
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