#endif
// Methods
+#if NET_2_0
+ [Obsolete ("This method has been deprecated", false)]
+#endif
[MonoTODO("Can we get this info under windows from the system?")]
public static WebProxy GetDefaultProxy ()
{
throw new ArgumentNullException ("host");
#endif
- if (bypassOnLocal && host.IsLoopback)
+ if (host.IsLoopback && bypassOnLocal)
+ return true;
+
+ if (address == null)
return true;
string server = host.Host;
if (String.Compare (server, "loopback", true, CultureInfo.InvariantCulture) == 0)
return true;
- try {
- IPAddress addr = IPAddress.Parse (server);
- if (IPAddress.IsLoopback (addr))
- return true;
- } catch {}
+ IPAddress addr = null;
+ if (IPAddress.TryParse (server, out addr) && IPAddress.IsLoopback (addr))
+ return true;
}
- if (bypassList == null)
+ if (bypassList == null || bypassList.Count == 0)
return false;
try {
}
}
- void ISerializable.GetObjectData (SerializationInfo serializationInfo,
- StreamingContext streamingContext)
+#if NET_2_0
+ protected virtual
+#endif
+ void GetObjectData (SerializationInfo serializationInfo, StreamingContext streamingContext)
{
serializationInfo.AddValue ("_BypassOnLocal", bypassOnLocal);
serializationInfo.AddValue ("_ProxyAddress", address);
#endif
}
+ void ISerializable.GetObjectData (SerializationInfo serializationInfo,
+ StreamingContext streamingContext)
+ {
+ GetObjectData (serializationInfo, streamingContext);
+ }
+
// Private Methods
// this compiles the regular expressions, and will throw
// an exception when an invalid one is found.