more minor changes to libproxy patch mozilla-1.9.2
authorWolfgang Rosenauer <wr@rosenauer.org>
Thu, 29 Jul 2010 10:38:24 +0200
branchmozilla-1.9.2
changeset 119 8fea954c3b28
parent 118 deb8fdcf4792
child 122 4270a8c31485
more minor changes to libproxy patch
mozilla-libproxy.patch
--- a/mozilla-libproxy.patch	Thu Jul 29 10:37:59 2010 +0200
+++ b/mozilla-libproxy.patch	Thu Jul 29 10:38:24 2010 +0200
@@ -169,7 +169,7 @@
 new file mode 100644
 --- /dev/null
 +++ b/toolkit/system/unixproxy/nsLibProxySettings.cpp
-@@ -0,0 +1,159 @@
+@@ -0,0 +1,167 @@
 +/* -*- 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
@@ -224,7 +224,7 @@
 +  NS_DECL_ISUPPORTS
 +  NS_DECL_NSISYSTEMPROXYSETTINGS
 +
-+  nsUnixSystemProxySettings() {}
++  nsUnixSystemProxySettings() { mProxyFactory = nsnull; }
 +  nsresult Init();
 +
 +private:
@@ -241,7 +241,6 @@
 +nsresult
 +nsUnixSystemProxySettings::Init()
 +{
-+  mProxyFactory = nsnull;
 +  return NS_OK;
 +}
 +
@@ -275,11 +274,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
++  // 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("; ");
 +    }
 +
@@ -292,7 +295,10 @@
 +                                        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) {
@@ -309,7 +315,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;