Author: gonzalo
Date: 2006-06-02 12:26:38 -0400 (Fri, 02 Jun 2006)
New Revision: 61415

Modified:
   trunk/mcs/class/System/System.Net/ChangeLog
   trunk/mcs/class/System/System.Net/WebProxy.cs
Log:
2006-06-02 Gonzalo Paniagua Javier <[EMAIL PROTECTED]>

        * WebProxy.cs: (IsBypassed) 'loopback', 'localhost' and any address
        that starts with 127 are special.



Modified: trunk/mcs/class/System/System.Net/ChangeLog
===================================================================
--- trunk/mcs/class/System/System.Net/ChangeLog 2006-06-02 16:16:06 UTC (rev 
61414)
+++ trunk/mcs/class/System/System.Net/ChangeLog 2006-06-02 16:26:38 UTC (rev 
61415)
@@ -1,3 +1,8 @@
+2006-06-02 Gonzalo Paniagua Javier <[EMAIL PROTECTED]>
+
+       * WebProxy.cs: (IsBypassed) 'loopback', 'localhost' and any address
+       that starts with 127 are special.
+
 2006-05-24 Gonzalo Paniagua Javier <[EMAIL PROTECTED]>
 
        * HttpListener.cs: Fixes race condition in BeginGetContext. Patch by

Modified: trunk/mcs/class/System/System.Net/WebProxy.cs
===================================================================
--- trunk/mcs/class/System/System.Net/WebProxy.cs       2006-06-02 16:16:06 UTC 
(rev 61414)
+++ trunk/mcs/class/System/System.Net/WebProxy.cs       2006-06-02 16:26:38 UTC 
(rev 61415)
@@ -29,6 +29,7 @@
 
 using System;
 using System.Collections;
+using System.Globalization;
 using System.Runtime.Serialization;
 using System.Text.RegularExpressions;
 
@@ -150,9 +151,24 @@
                        if (bypassOnLocal && host.IsLoopback)
                                return true;
 
-                       if (bypassOnLocal && host.Host.IndexOf ('.') == -1)
+                       string server = host.Host;
+                       if (bypassOnLocal && server.IndexOf ('.') == -1)
                                return true;
 
+                       // LAMESPEC
+                       if (!bypassOnLocal) {
+                               if (String.Compare (server, "localhost", true, 
CultureInfo.InvariantCulture) == 0)
+                                       return true;
+                               if (String.Compare (server, "loopback", true, 
CultureInfo.InvariantCulture) == 0)
+                                       return true;
+
+                               try {
+                                       IPAddress addr = IPAddress.Parse 
(server);
+                                       if (IPAddress.IsLoopback (addr))
+                                               return true;
+                               } catch {}
+                       }
+
                        try {                           
                                string hostStr = host.Scheme + "://" + 
host.Authority;                          
                                int i = 0;

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to