bug 1485956 - make DNS cache lookups respect DISABLE_TRR r=valentin

So that explicitly disabling TRR for specific resolves won't end up just
using the cached entry resolved with TRR!

MozReview-Commit-ID: HZ4AyKOMpet

Differential Revision: https://phabricator.services.mozilla.com/D4215

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Daniel Stenberg 2018-08-24 14:09:22 +00:00
parent 3b4c682a62
commit 7786d290c0
2 changed files with 18 additions and 11 deletions

View File

@ -152,7 +152,22 @@ IsLowPriority(uint16_t flags)
// this macro filters out any flags that are not used when constructing the // this macro filters out any flags that are not used when constructing the
// host key. the significant flags are those that would affect the resulting // host key. the significant flags are those that would affect the resulting
// host record (i.e., the flags that are passed down to PR_GetAddrInfoByName). // host record (i.e., the flags that are passed down to PR_GetAddrInfoByName).
#define RES_KEY_FLAGS(_f) ((_f) & nsHostResolver::RES_CANON_NAME) #define RES_KEY_FLAGS(_f) ((_f) & (nsHostResolver::RES_CANON_NAME | \
nsHostResolver::RES_DISABLE_TRR))
nsHostKey::nsHostKey(const nsACString& aHost, uint16_t aFlags,
uint16_t aAf, bool aPb, const nsACString& aOriginsuffix)
: host(aHost)
, flags(aFlags)
, af(aAf)
, pb(aPb)
, originSuffix(aOriginsuffix)
{
if (TRR_DISABLED(gTRRService->Mode())) {
// When not using TRR, lookup all answers as TRR-disabled
flags |= nsHostResolver::RES_DISABLE_TRR;
}
}
bool bool
nsHostKey::operator==(const nsHostKey& other) const nsHostKey::operator==(const nsHostKey& other) const

View File

@ -57,16 +57,8 @@ struct nsHostKey
uint16_t af; uint16_t af;
bool pb; bool pb;
const nsCString originSuffix; const nsCString originSuffix;
explicit nsHostKey(const nsACString& host, uint16_t flags,
nsHostKey(const nsACString& host, uint16_t flags, uint16_t af, bool pb, const nsACString& originSuffix);
uint16_t af, bool pb, const nsACString& originSuffix)
: host(host)
, flags(flags)
, af(af)
, pb(pb)
, originSuffix(originSuffix) {
}
bool operator==(const nsHostKey& other) const; bool operator==(const nsHostKey& other) const;
size_t SizeOfExcludingThis(mozilla::MallocSizeOf mallocSizeOf) const; size_t SizeOfExcludingThis(mozilla::MallocSizeOf mallocSizeOf) const;
PLDHashNumber Hash() const; PLDHashNumber Hash() const;