--- a/mozilla-libproxy.patch Wed Jul 28 10:39:36 2010 +0200
+++ b/mozilla-libproxy.patch Mon Aug 02 08:49:16 2010 +0200
@@ -167,7 +167,7 @@
new file mode 100644
--- /dev/null
+++ b/toolkit/system/unixproxy/nsLibProxySettings.cpp
-@@ -0,0 +1,170 @@
+@@ -0,0 +1,178 @@
+/* -*- 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
@@ -222,7 +222,7 @@
+ NS_DECL_ISUPPORTS
+ NS_DECL_NSISYSTEMPROXYSETTINGS
+
-+ nsUnixSystemProxySettings() {}
++ nsUnixSystemProxySettings() { mProxyFactory = nsnull; }
+ nsresult Init();
+
+private:
@@ -239,7 +239,6 @@
+nsresult
+nsUnixSystemProxySettings::Init()
+{
-+ mProxyFactory = nsnull;
+ return NS_OK;
+}
+
@@ -273,11 +272,15 @@
+ NS_ENSURE_TRUE(proxyArray, NS_ERROR_NOT_AVAILABLE);
+
+ // 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"
++ // libproxy returns an array of proxies in the format:
++ // <procotol>://[username:password@]proxy:port
++ // or
++ // direct://
++ //
++ // PAC format: "PROXY proxy1.foo.com:8080; PROXY proxy2.foo.com:8080; DIRECT"
+ int c = 0;
+ while (proxyArray[c] != NULL) {
-+ if (c != 0) {
++ if (!aResult.IsEmpty()) {
+ aResult.AppendLiteral("; ");
+ }
+
@@ -286,11 +289,14 @@
+ nsXPIDLCString hostPortString;
+ nsCOMPtr<nsIURI> proxyURI;
+
-+ rv = ios->NewURI(nsDependentCString(proxyArray[c]),
-+ nsnull,
-+ nsnull,
++ rv = ios->NewURI(nsDependentCString(proxyArray[c]),
++ nsnull,
++ nsnull,
+ getter_AddRefs(proxyURI));
-+ NS_ENSURE_SUCCESS(rv, rv);
++ if (NS_FAILED(rv)) {
++ c++;
++ continue;
++ }
+
+ proxyURI->GetScheme(schemeString);
+ if (NS_SUCCEEDED(proxyURI->SchemeIs("http", &isScheme)) && isScheme) {
@@ -307,7 +313,9 @@
+ c++;
+ }
+
-+//printf("returned PAC proxy string: %s\n", PromiseFlatCString(aResult).get());
++#ifdef DEBUG
++ printf("returned PAC proxy string: %s\n", PromiseFlatCString(aResult).get());
++#endif
+
+ PR_Free(proxyArray);
+ return NS_OK;