Unverified Commit fce77d70 authored by honfika's avatar honfika Committed by GitHub

Merge pull request #726 from justcoding121/master

beta
parents f3528b77 27791e02
...@@ -42,6 +42,11 @@ namespace Titanium.Web.Proxy.Examples.Basic ...@@ -42,6 +42,11 @@ namespace Titanium.Web.Proxy.Examples.Basic
await writeToConsole(exception.Message, ConsoleColor.Red); await writeToConsole(exception.Message, ConsoleColor.Red);
} }
}; };
proxyServer.TcpTimeWaitSeconds = 10;
proxyServer.ConnectionTimeOutSeconds = 15;
proxyServer.ReuseSocket = false;
proxyServer.EnableConnectionPool = false;
proxyServer.ForwardToUpstreamGateway = true; proxyServer.ForwardToUpstreamGateway = true;
proxyServer.CertificateManager.SaveFakeCertificates = true; proxyServer.CertificateManager.SaveFakeCertificates = true;
//proxyServer.ProxyBasicAuthenticateFunc = async (args, userName, password) => //proxyServer.ProxyBasicAuthenticateFunc = async (args, userName, password) =>
......
...@@ -1096,7 +1096,12 @@ namespace Titanium.Web.Proxy.Helpers ...@@ -1096,7 +1096,12 @@ namespace Titanium.Web.Proxy.Helpers
{ {
while (true) while (true)
{ {
string chunkHead = (await ReadLineAsync(cancellationToken))!; string? chunkHead = await ReadLineAsync(cancellationToken);
if (chunkHead == null)
{
return;
}
int idx = chunkHead.IndexOf(";"); int idx = chunkHead.IndexOf(";");
if (idx >= 0) if (idx >= 0)
{ {
......
...@@ -169,6 +169,7 @@ namespace Titanium.Web.Proxy ...@@ -169,6 +169,7 @@ namespace Titanium.Web.Proxy
if (part1 & part2) if (part1 & part2)
{ {
//connection is closed //connection is closed
await tcpConnectionFactory.Release(connection, true);
connection = null; connection = null;
} }
} }
...@@ -297,7 +298,11 @@ namespace Titanium.Web.Proxy ...@@ -297,7 +298,11 @@ namespace Titanium.Web.Proxy
if (args.HttpClient.Request.UpgradeToWebSocket) if (args.HttpClient.Request.UpgradeToWebSocket)
{ {
args.HttpClient.ConnectRequest!.TunnelType = TunnelType.Websocket; // connectRequest can be null for SOCKS connection
if (args.HttpClient.ConnectRequest != null)
{
args.HttpClient.ConnectRequest!.TunnelType = TunnelType.Websocket;
}
// if upgrading to websocket then relay the request without reading the contents // if upgrading to websocket then relay the request without reading the contents
await handleWebSocketUpgrade(args, args.ClientStream, connection, cancellationTokenSource, cancellationToken); await handleWebSocketUpgrade(args, args.ClientStream, connection, cancellationTokenSource, cancellationToken);
......
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