[System] Put back handling of direct ip addresses to ServicePoint::HostEntry (removed...
authorMarek Safar <marek.safar@gmail.com>
Tue, 16 Aug 2016 13:15:05 +0000 (15:15 +0200)
committerMarek Safar <marek.safar@gmail.com>
Tue, 16 Aug 2016 13:15:05 +0000 (15:15 +0200)
mcs/class/System/System.Net/ServicePoint.cs

index 108de70ffb3282873158d25fac7044fffd43a99b..953da503f1931c2a18e7b31d393775d8d70ffa58 100644 (file)
@@ -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 {