respect BypassOnLocal attribute in GetSystemWebProxy(); completes https://bugzilla...
authorMartin <test051102@hotmail.com>
Sun, 16 Oct 2011 11:17:10 +0000 (14:17 +0300)
committerMartin <test051102@hotmail.com>
Sun, 16 Oct 2011 11:17:10 +0000 (14:17 +0300)
mcs/class/System/System.Net/WebRequest.cs

index b209deccd92d25b8e1db8712c8e0c33789f2a78b..ac04866a238949c3d4fdb37704a92d3b64dd2101 100644 (file)
@@ -349,18 +349,23 @@ namespace System.Net
                                                }
                                        }
                                        
+                                       bool bBypassOnLocal=false;
                                        string[] bypassList=null;
-                                       string bypass = Environment.GetEnvironmentVariable ("no_proxy");
-                               
-                                       if (bypass == null)
-                                               bypass = Environment.GetEnvironmentVariable ("NO_PROXY");
-                               
-                                       if (bypass != null) {
-                                               bypass = bypass.Remove (bypass.IndexOf("*.local"), 7);
-                                               bypassList = bypass.Split (new char[]{','}, StringSplitOptions.RemoveEmptyEntries);
-                                           }
-                               
-                                       return new WebProxy (uri, false, bypassList);
+                                       ArrayList al=new ArrayList();                                   
+                                       string bypass = Environment.GetEnvironmentVariable ("no_proxy");
+
+                                       if (bypass == null)
+                                               bypass = Environment.GetEnvironmentVariable ("NO_PROXY");                       
+
+                                       bypassList = bypass.Split (new char[]{','}, StringSplitOptions.RemoveEmptyEntries);                                     
+
+                                       foreach(string str in bypassList)
+                                       {
+                                               if(str!="*.local")al.Add(str);
+                                                       else bBypassOnLocal=true;
+                                       }
+
+                                       return new WebProxy (uri, bBypassOnLocal, al.ToArray(typeof(string)) as string[]);
                                } catch (UriFormatException) { }
                        }