Bug 1503393 - never let "localhost" get sent to a proxy r=mayhemer
authorDaniel Stenberg <daniel@haxx.se>
Mon, 03 Dec 2018 16:27:11 +0200
changeset 450378 ba6a8e3b071640c50600884501c6266aa0393991
parent 450377 69de0ff59928c55b8dbcd4ddbe6d2b3a46f5283f
child 450379 6830e17b39c6b89a8343e11f1371159e2e30132d
push id110484
push usergijskruitbosch@gmail.com
push dateThu, 13 Dec 2018 13:59:22 +0000
treeherdermozilla-inbound@69ca4c75a331 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmayhemer
bugs1503393
milestone66.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
@@ -2027,16 +2027,22 @@ nsresult nsProtocolProxyService::Resolve
   nsresult rv = GetProxyURI(channel, getter_AddRefs(uri));
   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;
   }