Skip to content
This repository has been archived by the owner on Jul 9, 2023. It is now read-only.

Commit

Permalink
Merge pull request #725 from justcoding121/master
Browse files Browse the repository at this point in the history
fix
  • Loading branch information
honfika authored Dec 27, 2019
2 parents 746f8d6 + 66a45c0 commit f3528b7
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/Titanium.Web.Proxy/Network/Tcp/TcpConnectionFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,11 @@ private async Task<TcpServerConnection> createServerConnection(string remoteHost
}
}

if (isHttps && sslProtocol == SslProtocols.None)
{
sslProtocol = proxyServer.SupportedSslProtocols;
}

bool useUpstreamProxy1 = false;

// check if external proxy is set for HTTP/HTTPS
Expand Down
16 changes: 15 additions & 1 deletion src/Titanium.Web.Proxy/RequestHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,10 @@ private async Task handleHttpSessionRequest(ProxyEndPoint endPoint, HttpClientSt
UserData = connectArgs?.UserData
};

args.HttpClient.Request.IsHttps = isHttps;
if (isHttps)
{
args.HttpClient.Request.IsHttps = true;
}

try
{
Expand Down Expand Up @@ -156,7 +159,18 @@ await HeaderParser.ReadHeaders(clientStream, args.HttpClient.Request.Headers,
}

prefetchTask = null;
}

if (connection != null)
{
var socket = connection.TcpSocket;
bool part1 = socket.Poll(1000, SelectMode.SelectRead);
bool part2 = socket.Available == 0;
if (part1 & part2)
{
//connection is closed
connection = null;
}
}

// create a new connection if cache key changes.
Expand Down

0 comments on commit f3528b7

Please sign in to comment.