diff options
author | Marek Safar <marek.safar@gmail.com> | 2016-08-16 16:15:05 +0300 |
---|---|---|
committer | Marek Safar <marek.safar@gmail.com> | 2016-08-16 16:16:01 +0300 |
commit | d9e045251d57474528dbae0a284a5cd6314f06a3 (patch) | |
tree | ee23ff16d09c9c360ae16a668e4c87e940f3ba9f | |
parent | ca04bb1fb628f737f0226a2ff6d9f313218766d1 (diff) |
[System] Put back handling of direct ip addresses to ServicePoint::HostEntry (removed in 932359f). Fixes #42864
-rw-r--r-- | mcs/class/System/System.Net/ServicePoint.cs | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/mcs/class/System/System.Net/ServicePoint.cs b/mcs/class/System/System.Net/ServicePoint.cs index d58b62bd9e8..2ee8b0c0747 100644 --- a/mcs/class/System/System.Net/ServicePoint.cs +++ b/mcs/class/System/System.Net/ServicePoint.cs @@ -345,25 +345,25 @@ namespace System.Net lock (hostE) { string uriHost = uri.Host; - if (host == null) { - // Cannot do DNS resolution on literal IP addresses - if (uri.HostNameType == UriHostNameType.IPv6 || uri.HostNameType == UriHostNameType.IPv4) { - - if (uri.HostNameType == UriHostNameType.IPv6) { - // Remove square brackets - uriHost = uriHost.Substring (1, uriHost.Length - 2); - } - - // Creates IPHostEntry - host = new IPHostEntry(); - host.AddressList = new IPAddress[] { IPAddress.Parse (uriHost) }; + // Cannot do DNS resolution on literal IP addresses + if (uri.HostNameType == UriHostNameType.IPv6 || uri.HostNameType == UriHostNameType.IPv4) { + if (host != null) return host; + + if (uri.HostNameType == UriHostNameType.IPv6) { + // Remove square brackets + uriHost = uriHost.Substring (1, uriHost.Length - 2); } - } else { - if (!HasTimedOut) - return host; + + // Creates IPHostEntry + host = new IPHostEntry(); + host.AddressList = new IPAddress[] { IPAddress.Parse (uriHost) }; + return host; } + if (!HasTimedOut) + return host; + lastDnsResolve = DateTime.UtcNow; try { |