WebRequest.GetDefaultWebProxy() must not assume the type of the system proxy.
authorJeffrey Stedfast <jeff@xamarin.com>
Tue, 8 May 2012 22:59:13 +0000 (18:59 -0400)
committerJeffrey Stedfast <jeff@xamarin.com>
Tue, 8 May 2012 22:59:13 +0000 (18:59 -0400)
mcs/class/System/System.Net/WebRequest.cs

index b7bf9bc5c1fa23c2f9036fae6a89ed26bed70070..ad5a8e298d3bd609c5e781d080c5274df3b83231 100644 (file)
@@ -235,9 +235,14 @@ namespace System.Net
                        
                        ProxyElement pe = sec.Proxy;
                        
-                       if ((pe.UseSystemDefault != ProxyElement.UseSystemDefaultValues.False) && (pe.ProxyAddress == null))
-                               p = (WebProxy) GetSystemWebProxy ();
-                       else
+                       if ((pe.UseSystemDefault != ProxyElement.UseSystemDefaultValues.False) && (pe.ProxyAddress == null)) {
+                               IWebProxy proxy = GetSystemWebProxy ();
+                               
+                               if (!(proxy is WebProxy))
+                                       return proxy;
+                               
+                               p = (WebProxy) proxy;
+                       } else
                                p = new WebProxy ();
                        
                        if (pe.ProxyAddress != null)