# HG changeset patch # User Wolfgang Rosenauer # Date 1280295401 -7200 # Node ID 04527a174eec83ac1d187fe7fd41476530fb6438 # Parent 22a2c93a47eee574df820e76dabd2ddba427b764 libproxy polish diff -r 22a2c93a47ee -r 04527a174eec mozilla-libproxy.patch --- a/mozilla-libproxy.patch Wed Jul 28 07:36:02 2010 +0200 +++ b/mozilla-libproxy.patch Wed Jul 28 07:36:41 2010 +0200 @@ -169,7 +169,7 @@ new file mode 100644 --- /dev/null +++ b/toolkit/system/unixproxy/nsLibProxySettings.cpp -@@ -0,0 +1,162 @@ +@@ -0,0 +1,159 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 @@ -188,7 +188,7 @@ + * + * The Initial Developer of the Original Code is + * Wolfgang Rosenauer . -+ * Portions created by the Initial Developer are Copyright (C) 2009 ++ * Portions created by the Initial Developer are Copyright (C) 2010 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): @@ -234,7 +234,6 @@ + } + + pxProxyFactory *mProxyFactory; -+ nsCOMPtr mIOService; +}; + +NS_IMPL_ISUPPORTS1(nsUnixSystemProxySettings, nsISystemProxySettings) @@ -262,12 +261,10 @@ + if (!mProxyFactory) { + mProxyFactory = px_proxy_factory_new(); + } -+ NS_ENSURE_TRUE(mProxyFactory, NS_ERROR_OUT_OF_MEMORY); ++ NS_ENSURE_TRUE(mProxyFactory, NS_ERROR_NOT_AVAILABLE); + -+ if (!mIOService) { -+ mIOService = do_GetIOService(); -+ } -+ NS_ENSURE_TRUE(mIOService, NS_ERROR_FAILURE); ++ nsCOMPtr ios = do_GetIOService(&rv); ++ NS_ENSURE_SUCCESS(rv, rv); + + nsCAutoString spec; + rv = aURI->GetSpec(spec); @@ -275,11 +272,11 @@ + + char **proxyArray = nsnull; + proxyArray = px_proxy_factory_get_proxies(mProxyFactory, (char*)(spec.get())); -+ NS_ENSURE_TRUE(proxyArray, NS_ERROR_FAILURE); ++ NS_ENSURE_TRUE(proxyArray, NS_ERROR_NOT_AVAILABLE); + -+ // PAC string accepts -+ // http, proxy, socks, socks4, socks5, direct, unknown -+ // example: "PROXY proxy1.foo.com:8080; PROXY proxy2.foo.com:8080; DIRECT" ++ // Translate libproxy's output to PAC string as expected ++ // libproxy's prefixes: http, proxy, socks, socks4, socks5, direct, unknown ++ // PAC format: "PROXY proxy1.foo.com:8080; PROXY proxy2.foo.com:8080; DIRECT" + int c = 0; + while (proxyArray[c] != NULL) { + if (c != 0) { @@ -291,10 +288,10 @@ + nsXPIDLCString hostPortString; + nsCOMPtr proxyURI; + -+ rv = mIOService->NewURI(nsDependentCString(proxyArray[c]), -+ nsnull, -+ nsnull, -+ getter_AddRefs(proxyURI)); ++ rv = ios->NewURI(nsDependentCString(proxyArray[c]), ++ nsnull, ++ nsnull, ++ getter_AddRefs(proxyURI)); + NS_ENSURE_SUCCESS(rv, rv); + + proxyURI->GetScheme(schemeString);