Bug 1503393 - Never let "localhost" get sent to a proxy. r=mayhemer, a=RyanVM
authorDaniel Stenberg <daniel@haxx.se>
Mon, 03 Dec 2018 16:27:11 +0200
changeset 509074 08b14d60d0fcbe836971c0cd3378f4e67e357334
parent 509073 a475f96d74721bf5bfd62ef33dd2c4b186faea03
child 509075 005811564dc5e60f72bd43ca09408d9b01968d90
push id1905
push userffxbld-merge
push dateMon, 21 Jan 2019 12:33:13 +0000
treeherdermozilla-release@c2fca1944d8c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmayhemer, RyanVM
bugs1503393
milestone65.0
Bug 1503393 - Never let "localhost" get sent to a proxy. r=mayhemer, a=RyanVM
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;
   }