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

Commit f3528b7

Browse files
authored
Merge pull request #725 from justcoding121/master
fix
2 parents 746f8d6 + 66a45c0 commit f3528b7

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

src/Titanium.Web.Proxy/Network/Tcp/TcpConnectionFactory.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,11 @@ private async Task<TcpServerConnection> createServerConnection(string remoteHost
302302
}
303303
}
304304

305+
if (isHttps && sslProtocol == SslProtocols.None)
306+
{
307+
sslProtocol = proxyServer.SupportedSslProtocols;
308+
}
309+
305310
bool useUpstreamProxy1 = false;
306311

307312
// check if external proxy is set for HTTP/HTTPS

src/Titanium.Web.Proxy/RequestHandler.cs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,10 @@ private async Task handleHttpSessionRequest(ProxyEndPoint endPoint, HttpClientSt
6868
UserData = connectArgs?.UserData
6969
};
7070

71-
args.HttpClient.Request.IsHttps = isHttps;
71+
if (isHttps)
72+
{
73+
args.HttpClient.Request.IsHttps = true;
74+
}
7275

7376
try
7477
{
@@ -156,7 +159,18 @@ await HeaderParser.ReadHeaders(clientStream, args.HttpClient.Request.Headers,
156159
}
157160

158161
prefetchTask = null;
162+
}
159163

164+
if (connection != null)
165+
{
166+
var socket = connection.TcpSocket;
167+
bool part1 = socket.Poll(1000, SelectMode.SelectRead);
168+
bool part2 = socket.Available == 0;
169+
if (part1 & part2)
170+
{
171+
//connection is closed
172+
connection = null;
173+
}
160174
}
161175

162176
// create a new connection if cache key changes.

0 commit comments

Comments
 (0)