Commit 53b77f53 authored by justcoding121's avatar justcoding121

used named params for readability

parent d6fa5d60
...@@ -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);
......
...@@ -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) =>
......
...@@ -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
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment