bug 1440563 - set the RD bit in DOH requests r=valentin
authorDaniel Stenberg <daniel@haxx.se>
Mon, 05 Mar 2018 08:47:52 +0100
changeset 406617 83df6cf24cf8fa59eb338ce0bd7bedac289c5d33
parent 406616 d0074d179c010753b0f35b72689d636912dacec8
child 406618 c0b2aa2dc564deaa6a3783d22855030a35fd6a0c
push id60629
push userdaniel@haxx.se
push dateMon, 05 Mar 2018 21:17:22 +0000
treeherderautoland@83df6cf24cf8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersvalentin
bugs1440563
milestone60.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 1440563 - set the RD bit in DOH requests r=valentin RFC 1035 section 4.1.1 documents this bit as: RD - Recursion Desired - this bit may be set in a query and is copied into the response. If RD is set, it directs the name server to pursue the query recursively. Recursive query support is optional. MozReview-Commit-ID: 8iHDgNtA1L1
netwerk/dns/TRR.cpp
testing/xpcshell/moz-http2/moz-http2.js
--- a/netwerk/dns/TRR.cpp
+++ b/netwerk/dns/TRR.cpp
@@ -60,17 +60,17 @@ TRR::Notify(nsITimer *aTimer)
 //
 nsresult
 TRR::DohEncode(nsCString &aBody)
 {
   aBody.Truncate();
   // Header
   aBody += '\0';
   aBody += '\0'; // 16 bit id
-  aBody += '\0'; // |QR|   Opcode  |AA|TC|RD|
+  aBody += 0x01; // |QR|   Opcode  |AA|TC|RD| Set the RD bit
   aBody += '\0'; // |RA|   Z    |   RCODE   |
   aBody += '\0';
   aBody += 1;    // QDCOUNT (number of entries in the question section)
   aBody += '\0';
   aBody += '\0'; // ANCOUNT
   aBody += '\0';
   aBody += '\0'; // NSCOUNT
   aBody += '\0';
--- a/testing/xpcshell/moz-http2/moz-http2.js
+++ b/testing/xpcshell/moz-http2/moz-http2.js
@@ -560,17 +560,17 @@ function handleRequest(req, res) {
     res.writeHead(200);
     res.write(content);
     res.end("");
     return;
 
   }
 
   // for use with test_trr.js
-  else if (u.path === "/dns-get?ct&dns=AAAAAAABAAAAAAAAA2dldAdleGFtcGxlA2NvbQAAAQAB") {
+  else if (u.path === "/dns-get?ct&dns=AAABAAABAAAAAAAAA2dldAdleGFtcGxlA2NvbQAAAQAB") {
     // the query string asks for an A entry for get.example.com
     // get.example.com has A entry 1.2.3.4
     var content= new Buffer("00000100000100010000000003676574076578616D706C6503636F6D0000010001C00C0001000100000037000401020304", "hex");
     res.setHeader('Content-Type', 'application/dns-udpwireformat');
     res.setHeader('Content-Length', content.length);
     res.writeHead(200);
     res.write(content);
     res.end("");