This repository was archived by the owner on Jul 9, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +2
-13
lines changed
src/Titanium.Web.Proxy/Network/Tcp Expand file tree Collapse file tree 1 file changed +2
-13
lines changed Original file line number Diff line number Diff line change @@ -287,17 +287,8 @@ private async Task<TcpServerConnection> createServerConnection(string remoteHost
287287 var hostname = useUpstreamProxy ? externalProxy . HostName : remoteHostName ;
288288 var port = useUpstreamProxy ? externalProxy . Port : remotePort ;
289289
290- IPHostEntry ipHostEntry ;
291- if ( IPAddress . TryParse ( hostname , out var ipAddress ) )
292- {
293- ipHostEntry = await Dns . GetHostEntryAsync ( ipAddress ) ;
294- }
295- else
296- {
297- ipHostEntry = await Dns . GetHostEntryAsync ( hostname ) ;
298- }
299-
300- if ( ipHostEntry == null || ipHostEntry . AddressList . Length == 0 )
290+ var ipAddresses = await Dns . GetHostAddressesAsync ( hostname ) ;
291+ if ( ipAddresses == null || ipAddresses . Length == 0 )
301292 {
302293 throw new Exception ( $ "Could not resolve the hostname { hostname } ") ;
303294 }
@@ -307,8 +298,6 @@ private async Task<TcpServerConnection> createServerConnection(string remoteHost
307298 session . TimeLine [ "Dns Resolved" ] = DateTime . Now ;
308299 }
309300
310- var ipAddresses = ipHostEntry . AddressList ;
311-
312301 for ( int i = 0 ; i < ipAddresses . Length ; i ++ )
313302 {
314303 try
You can’t perform that action at this time.
0 commit comments