bug 1455972 - make TRR prefer address responses to CNAME r=mcmanus
authorDaniel Stenberg <daniel@haxx.se>
Mon, 23 Apr 2018 11:26:04 +0200
changeset 468794 4d53dc29f81ec8f30549ef4db3e3f607b8fb5a19
parent 468793 9a467f3fab5c201cea99e829fdca23297f1d7991
child 468795 1af032ceb563b6eedebc3954391db86a5a169677
push id9165
push userasasaki@mozilla.com
push dateThu, 26 Apr 2018 21:04:54 +0000
treeherdermozilla-beta@064c3804de2e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmcmanus
bugs1455972
milestone61.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 1455972 - make TRR prefer address responses to CNAME r=mcmanus In a DOH response to a query asking for an A or AAAA record, a CNAME response is often accompanied by A/AAAA resources as well. With this change, TRR now rather use those address records than following the CNAME record. This saves name resolver round-trips. MozReview-Commit-ID: GcjZj5Ehz68
netwerk/dns/TRR.cpp
--- a/netwerk/dns/TRR.cpp
+++ b/netwerk/dns/TRR.cpp
@@ -814,17 +814,17 @@ TRR::FailData()
 
 nsresult
 TRR::On200Response()
 {
   // decode body and create an AddrInfo struct for the response
   nsresult rv = DohDecode();
 
   if (NS_SUCCEEDED(rv)) {
-    if (!mCname.IsEmpty()) {
+    if (!mDNS.mAddresses.getFirst() && !mCname.IsEmpty()) {
       if (!--mCnameLoop) {
         LOG(("TRR::On200Response CNAME loop, eject!\n"));
       } else  {
         LOG(("TRR::On200Response CNAME %s => %s (%u)\n", mHost.get(), mCname.get(),
              mCnameLoop));
         RefPtr<TRR> trr = new TRR(mHostResolver, mRec, mCname,
                                   mType, mCnameLoop, mPB);
         rv = NS_DispatchToMainThread(trr);