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
35a48908
Unverified
Commit
35a48908
authored
Nov 25, 2019
by
honfika
Committed by
GitHub
Nov 25, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #681 from justcoding121/master
Another websocket fix
parents
b584af90
9e02fc77
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
24 additions
and
15 deletions
+24
-15
ExplicitClientHandler.cs
src/Titanium.Web.Proxy/ExplicitClientHandler.cs
+8
-8
TcpConnectionFactory.cs
src/Titanium.Web.Proxy/Network/Tcp/TcpConnectionFactory.cs
+2
-1
RequestHandler.cs
src/Titanium.Web.Proxy/RequestHandler.cs
+11
-3
TransparentClientHandler.cs
src/Titanium.Web.Proxy/TransparentClientHandler.cs
+3
-3
No files found.
src/Titanium.Web.Proxy/ExplicitClientHandler.cs
View file @
35a48908
...
...
@@ -140,8 +140,8 @@ namespace Titanium.Web.Proxy
{
// todo: this is a hack, because Titanium does not support HTTP protocol changing currently
var
connection
=
await
tcpConnectionFactory
.
GetServerConnection
(
this
,
connectArgs
,
isConnect
:
true
,
applicationProtocols
:
SslExtensions
.
Http2ProtocolAsList
,
noCache
:
true
,
cancellationToken
:
cancellationToken
);
true
,
SslExtensions
.
Http2ProtocolAsList
,
true
,
cancellationToken
);
http2Supported
=
connection
.
NegotiatedApplicationProtocol
==
SslApplicationProtocol
.
Http2
;
...
...
@@ -170,8 +170,8 @@ namespace Titanium.Web.Proxy
// don't pass cancellation token here
// it could cause floating server connections when client exits
prefetchConnectionTask
=
tcpConnectionFactory
.
GetServerConnection
(
this
,
connectArgs
,
isConnect
:
true
,
applicationProtocols
:
null
,
noCache
:
false
,
cancellationToken
:
CancellationToken
.
None
);
true
,
null
,
false
,
CancellationToken
.
None
);
}
}
...
...
@@ -253,8 +253,8 @@ namespace Titanium.Web.Proxy
// If we detected that client tunnel CONNECTs without SSL by checking for empty client hello then
// this connection should not be HTTPS.
var
connection
=
await
tcpConnectionFactory
.
GetServerConnection
(
this
,
connectArgs
,
isConnect
:
true
,
applicationProtocols
:
SslExtensions
.
Http2ProtocolAsList
,
noCache
:
true
,
cancellationToken
:
cancellationToken
);
true
,
SslExtensions
.
Http2ProtocolAsList
,
true
,
cancellationToken
);
try
{
...
...
@@ -325,8 +325,8 @@ namespace Titanium.Web.Proxy
}
var
connection
=
await
tcpConnectionFactory
.
GetServerConnection
(
this
,
connectArgs
,
isConnect
:
true
,
applicationProtocols
:
SslExtensions
.
Http2ProtocolAsList
,
noCache
:
true
,
cancellationToken
:
cancellationToken
);
true
,
SslExtensions
.
Http2ProtocolAsList
,
true
,
cancellationToken
);
try
{
#if NETSTANDARD2_1
...
...
src/Titanium.Web.Proxy/Network/Tcp/TcpConnectionFactory.cs
View file @
35a48908
...
...
@@ -190,6 +190,7 @@ namespace Titanium.Web.Proxy.Network.Tcp
customUpStreamProxy
??
(
isHttps
?
server
.
UpStreamHttpsProxy
:
server
.
UpStreamHttpProxy
),
noCache
,
cancellationToken
);
}
/// <summary>
/// Gets a TCP connection to server from connection pool.
/// </summary>
...
...
@@ -441,7 +442,7 @@ retry:
connectRequest
.
Headers
.
AddHeader
(
HttpHeader
.
GetProxyAuthorizationHeader
(
externalProxy
.
UserName
,
externalProxy
.
Password
));
}
await
stream
.
WriteRequestAsync
(
connectRequest
,
cancellationToken
:
cancellationToken
);
await
stream
.
WriteRequestAsync
(
connectRequest
,
cancellationToken
);
var
httpStatus
=
await
stream
.
ReadResponseStatus
(
cancellationToken
);
...
...
src/Titanium.Web.Proxy/RequestHandler.cs
View file @
35a48908
...
...
@@ -261,11 +261,19 @@ namespace Titanium.Web.Proxy
// do not cache server connections for WebSockets
bool
noCache
=
args
.
HttpClient
.
Request
.
UpgradeToWebSocket
;
if
(
noCache
)
{
serverConnection
=
null
;
}
// a connection generator task with captured parameters via closure.
Func
<
Task
<
TcpServerConnection
>>
generator
=
()
=>
tcpConnectionFactory
.
GetServerConnection
(
this
,
args
,
isConnect
:
false
,
applicationProtocol
:
sslApplicationProtocol
,
noCache
:
noCache
,
cancellationToken
:
cancellationToken
);
tcpConnectionFactory
.
GetServerConnection
(
this
,
args
,
false
,
sslApplicationProtocol
,
noCache
,
cancellationToken
);
// for connection pool, retry fails until cache is exhausted.
return
await
retryPolicy
<
ServerConnectionException
>().
ExecuteAsync
(
async
(
connection
)
=>
...
...
src/Titanium.Web.Proxy/TransparentClientHandler.cs
View file @
35a48908
...
...
@@ -89,9 +89,9 @@ namespace Titanium.Web.Proxy
else
{
var
connection
=
await
tcpConnectionFactory
.
GetServerConnection
(
httpsHostName
,
endPoint
.
Port
,
httpVersion
:
HttpHeader
.
VersionUnknown
,
isHttps
:
false
,
applicationProtocols
:
null
,
isConnect
:
true
,
proxyServer
:
this
,
session
:
null
,
upStreamEndPoint
:
UpStreamEndPoint
,
externalProxy
:
UpStreamHttpsProxy
,
noCache
:
true
,
cancellationToken
:
cancellationToken
);
HttpHeader
.
VersionUnknown
,
false
,
null
,
true
,
this
,
null
,
UpStreamEndPoint
,
UpStreamHttpsProxy
,
true
,
cancellationToken
);
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