Bladeren bron

WebRequest.GetDefaultWebProxy() must not assume the type of the system proxy.

Jeffrey Stedfast 13 jaren geleden
bovenliggende
commit
0fd6a5a564
1 gewijzigde bestanden met toevoegingen van 8 en 3 verwijderingen
  1. 8 3
      mcs/class/System/System.Net/WebRequest.cs

+ 8 - 3
mcs/class/System/System.Net/WebRequest.cs

@@ -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)