Bug 1503393 - never let "localhost" get sent to a proxy. r=mayhemer
☠☠ backed out by d277cd7dcbb4 ☠ ☠
authorDaniel Stenberg <daniel@haxx.se>
Mon, 19 Nov 2018 21:25:40 +0200
changeset 503480 606cfe2ddd368dc617f52795ddb2f5016d3ef1a8
parent 503479 5b6f0d586bf79f1427d822cd562ad6a8c248b4f2
child 503481 7b1514667292828ecbabc998ad42947da468c0e9
push id10290
push userffxbld-merge
push dateMon, 03 Dec 2018 16:23:23 +0000
treeherdermozilla-beta@700bed2445e6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmayhemer
bugs1503393
milestone65.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1503393 - never let "localhost" get sent to a proxy. r=mayhemer
netwerk/base/nsProtocolProxyService.cpp
--- a/netwerk/base/nsProtocolProxyService.cpp
+++ b/netwerk/base/nsProtocolProxyService.cpp
@@ -2220,16 +2220,22 @@ nsProtocolProxyService::Resolve_Internal
     if (NS_FAILED(rv)) return rv;
 
     // See bug #586908.
     // Avoid endless loop if |uri| is the current PAC-URI. Returning OK
     // here means that we will not use a proxy for this connection.
     if (mPACMan && mPACMan->IsPACURI(uri))
         return NS_OK;
 
+    // if proxies are enabled and this host:port combo is supposed to use a
+    // proxy, check for a proxy.
+    if ((mProxyConfig == PROXYCONFIG_DIRECT) ||
+        !CanUseProxy(uri, info.defaultPort))
+        return NS_OK;
+
     bool mainThreadOnly;
     if (mSystemProxySettings &&
         mProxyConfig == PROXYCONFIG_SYSTEM &&
         NS_SUCCEEDED(mSystemProxySettings->GetMainThreadOnly(&mainThreadOnly)) &&
         !mainThreadOnly) {
         *usePACThread = true;
         return NS_OK;
     }
@@ -2283,23 +2289,16 @@ nsProtocolProxyService::Resolve_Internal
         if (NS_SUCCEEDED(mSystemProxySettings->
                          GetProxyForURI(spec, scheme, host, port,
                                         pacString))) {
             ProcessPACString(pacString, 0, result);
             return NS_OK;
         }
     }
 
-    // if proxies are enabled and this host:port combo is supposed to use a
-    // proxy, check for a proxy.
-    if (mProxyConfig == PROXYCONFIG_DIRECT ||
-        (mProxyConfig == PROXYCONFIG_MANUAL &&
-         !CanUseProxy(uri, info.defaultPort)))
-        return NS_OK;
-
     // Proxy auto config magic...
     if (mProxyConfig == PROXYCONFIG_PAC || mProxyConfig == PROXYCONFIG_WPAD) {
         // Do not query PAC now.
         *usePACThread = true;
         return NS_OK;
     }
 
     // If we aren't in manual proxy configuration mode then we don't
@@ -2555,9 +2554,9 @@ nsProtocolProxyService::GetIsPACLoading(
     *aResult = false;
     if (mPACMan && mPACMan->IsLoading()) {
         *aResult = true;
     }
     return NS_OK;
 }
 
 } // namespace net
-} // namespace mozilla
\ No newline at end of file
+} // namespace mozilla