[Mono-bugs] [Bug 691291] Incomplete proxy support/ system wide proxy bypass list is ignored

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Fri Sep 30 03:44:58 EDT 2011


https://bugzilla.novell.com/show_bug.cgi?id=691291

https://bugzilla.novell.com/show_bug.cgi?id=691291#c4


--- Comment #4 from QuickJack . <test051102 at hotmail.com> 2011-09-30 07:44:57 UTC ---
The code block above containing the original method is a bit wrong (copy/paste
problem). Because we cannot edit cbug comments, here's the corrected version:

[MonoTODO("Look in other places for proxy config info")]
public static IWebProxy GetSystemWebProxy ()
{
    string address = Environment.GetEnvironmentVariable ("http_proxy");
    if (address == null)
        address = Environment.GetEnvironmentVariable ("HTTP_PROXY");

    if (address != null) {
        try {
            if (!address.StartsWith ("http://"))
                address = "http://" + address;
            Uri uri = new Uri (address);
            IPAddress ip;
            if (IPAddress.TryParse (uri.Host, out ip)) {
                if (IPAddress.Any.Equals (ip)) {
                    UriBuilder builder = new UriBuilder (uri);
                    builder.Host = "127.0.0.1";
                    uri = builder.Uri;
                } else if (IPAddress.IPv6Any.Equals (ip)) {
                    UriBuilder builder = new UriBuilder (uri);
                    builder.Host = "[::1]";
                    uri = builder.Uri;
                }
            }
            return new WebProxy (uri);
        } catch (UriFormatException) { }
    }

    if (cfGetDefaultProxy != null)
        return (IWebProxy) cfGetDefaultProxy.Invoke (null, null);

    return new WebProxy ();
}

-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the mono-bugs mailing list