X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mcs%2Fclass%2FSystem%2FSystem.Net%2FServicePoint.cs;h=9b6cc5cc5e4d39b218d617e542910fb2fdb1bab6;hb=1b6292607cf62656e9e5d4f0f16cdbb57c08bc0b;hp=13c06ec493f499c3f5636c35248940ba13b3a6cc;hpb=ba3384aa88a389c308d8258e4ae66caaa2856221;p=mono.git diff --git a/mcs/class/System/System.Net/ServicePoint.cs b/mcs/class/System/System.Net/ServicePoint.cs index 13c06ec493f..9b6cc5cc5e4 100644 --- a/mcs/class/System/System.Net/ServicePoint.cs +++ b/mcs/class/System/System.Net/ServicePoint.cs @@ -42,7 +42,7 @@ namespace System.Net { public class ServicePoint { - Uri uri; + readonly Uri uri; int connectionLimit; int maxIdleTime; int currentConnections; @@ -345,15 +345,31 @@ namespace System.Net lock (hostE) { string uriHost = uri.Host; - if (host == null || HasTimedOut) { - lastDnsResolve = DateTime.UtcNow; + // Cannot do DNS resolution on literal IP addresses + if (uri.HostNameType == UriHostNameType.IPv6 || uri.HostNameType == UriHostNameType.IPv4) { + if (host != null) + return host; - try { - host = Dns.GetHostEntry (uriHost); - } - catch (Exception) { - return null; + 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) }; + return host; + } + + if (!HasTimedOut && host != null) + return host; + + lastDnsResolve = DateTime.UtcNow; + + try { + host = Dns.GetHostEntry (uriHost); + } catch { + return null; } } @@ -489,6 +505,11 @@ namespace System.Net return true; } } + + internal Socket GetConnection(PooledStream PooledStream, object owner, bool async, out IPAddress address, ref Socket abortSocket, ref Socket abortSocket6) + { + throw new NotImplementedException (); + } } }