bug 1440563 - set the RD bit in DOH requests r?valentin draft
authorDaniel Stenberg <daniel@haxx.se>
Mon, 05 Mar 2018 08:47:52 +0100
changeset 763114 049bc9ce60fae0040a3eb1ce825e807f4f9c260a
parent 763042 69f9ae4f6e8943d24569a9e4380f6df869f56b73
push id101342
push userbmo:daniel@haxx.se
push dateMon, 05 Mar 2018 12:20:38 +0000
reviewersvalentin
bugs1440563
milestone60.0a1
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("");