Bug 1028195 - make proxy bypass rule consistent; r?bagder
MozReview-Commit-ID: CMAUt1p3L3u
--- a/netwerk/base/nsProtocolProxyService.cpp
+++ b/netwerk/base/nsProtocolProxyService.cpp
@@ -721,17 +721,19 @@ nsProtocolProxyService::CanUseProxy(nsIU
}
else {
NS_WARNING("unknown address family");
return true; // allow proxying
}
}
// Don't use proxy for local hosts (plain hostname, no dots)
- if (!is_ipaddr && mFilterLocalHosts && !host.Contains('.')) {
+ if ((!is_ipaddr && mFilterLocalHosts && !host.Contains('.')) ||
+ host.EqualsLiteral("127.0.0.1") ||
+ host.EqualsLiteral("::1")) {
LOG(("Not using proxy for this local host [%s]!\n", host.get()));
return false; // don't allow proxying
}
int32_t index = -1;
while (++index < int32_t(mHostFiltersArray.Length())) {
HostInfo *hinfo = mHostFiltersArray[index];
--- a/toolkit/system/windowsproxy/nsWindowsSystemProxySettings.cpp
+++ b/toolkit/system/windowsproxy/nsWindowsSystemProxySettings.cpp
@@ -12,16 +12,17 @@
#include "nsISystemProxySettings.h"
#include "nsIServiceManager.h"
#include "mozilla/ModuleUtils.h"
#include "nsPrintfCString.h"
#include "nsNetCID.h"
#include "nsISupportsPrimitives.h"
#include "nsIURI.h"
#include "GeckoProfiler.h"
+#include "prnetdb.h"
#include "ProxyUtils.h"
class nsWindowsSystemProxySettings final : public nsISystemProxySettings
{
public:
NS_DECL_THREADSAFE_ISUPPORTS
NS_DECL_NSISYSTEMPROXYSETTINGS
@@ -143,20 +144,28 @@ nsWindowsSystemProxySettings::MatchOverr
int32_t delimiter = cbuf.FindCharInSet(" ;", start);
if (delimiter == -1)
delimiter = end;
if (delimiter != start) {
const nsAutoCString override(Substring(cbuf, start,
delimiter - start));
if (override.EqualsLiteral("<local>")) {
- // This override matches local addresses.
- if (host.EqualsLiteral("localhost") ||
- host.EqualsLiteral("127.0.0.1"))
+ PRNetAddr addr;
+ bool isIpAddr = (PR_StringToNetAddr(host.get(), &addr) == PR_SUCCESS);
+
+ // Don't use proxy for local hosts (plain hostname, no dots)
+ if (!isIpAddr && !host.Contains('.')) {
return true;
+ }
+
+ if (host.EqualsLiteral("127.0.0.1") ||
+ host.EqualsLiteral("::1")) {
+ return true;
+ }
} else if (PatternMatch(host, override)) {
return true;
}
}
if (delimiter == end)
break;
start = ++delimiter;