Commit 48c041e6 authored by justcoding121's avatar justcoding121

#565 Verify hostname before prefetching connection

parent 10c923e3
...@@ -153,6 +153,11 @@ namespace Titanium.Web.Proxy ...@@ -153,6 +153,11 @@ namespace Titanium.Web.Proxy
} }
if (EnableTcpServerConnectionPrefetch) if (EnableTcpServerConnectionPrefetch)
{
//make sure the host can be resolved before creating the prefetch task
var ipAddresses = await Dns.GetHostAddressesAsync(connectArgs.HttpClient.Request.RequestUri.Host);
if (ipAddresses != null && ipAddresses.Length > 0)
{ {
//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
...@@ -160,6 +165,7 @@ namespace Titanium.Web.Proxy ...@@ -160,6 +165,7 @@ namespace Titanium.Web.Proxy
isConnect: true, applicationProtocols: null, noCache: false, isConnect: true, applicationProtocols: null, noCache: false,
cancellationToken: CancellationToken.None); cancellationToken: CancellationToken.None);
} }
}
X509Certificate2 certificate = null; X509Certificate2 certificate = null;
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