Bug 1540656 - Use dns-packet node module in test_trr.js r=dragana
☠☠ backed out by 9ce75ad03d72 ☠ ☠
authorValentin Gosu <valentin.gosu@gmail.com>
Thu, 04 Apr 2019 09:30:44 +0000
changeset 467925 631a1aae6fb0038e9f1b4b56ebf7db0e99786f07
parent 467924 408104f784ef610f7d1b9f12edc114fa799465ca
child 467926 70a90b960aef224ca2b85718e534e7a9b8c1e5f1
push id35813
push useraiakab@mozilla.com
push dateThu, 04 Apr 2019 16:07:30 +0000
treeherdermozilla-central@aa623df2ae8f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdragana
bugs1540656
milestone68.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 1540656 - Use dns-packet node module in test_trr.js r=dragana Differential Revision: https://phabricator.services.mozilla.com/D25671
netwerk/test/unit/test_trr.js
testing/xpcshell/moz-http2/moz-http2.js
--- a/netwerk/test/unit/test_trr.js
+++ b/netwerk/test/unit/test_trr.js
@@ -101,128 +101,128 @@ class DNSListener {
   }
 }
 
 
 // verify basic A record
 add_task(async function test1() {
   dns.clearCache(true);
   Services.prefs.setIntPref("network.trr.mode", 2); // TRR-first
-  Services.prefs.setCharPref("network.trr.uri", `https://foo.example.com:${h2Port}/dns`);
+  Services.prefs.setCharPref("network.trr.uri", `https://foo.example.com:${h2Port}/doh?responseIP=2.2.2.2`);
 
-  await new DNSListener("bar.example.com", "127.0.0.1");
+  await new DNSListener("bar.example.com", "2.2.2.2");
 });
 
 // verify basic A record - without bootstrapping
 add_task(async function test1b() {
   dns.clearCache(true);
   Services.prefs.setIntPref("network.trr.mode", 3); // TRR-only
-  Services.prefs.setCharPref("network.trr.uri", `https://foo.example.com:${h2Port}/dns`);
+  Services.prefs.setCharPref("network.trr.uri", `https://foo.example.com:${h2Port}/doh?responseIP=3.3.3.3`);
   Services.prefs.clearUserPref("network.trr.bootstrapAddress");
   Services.prefs.setCharPref("network.dns.localDomains", "foo.example.com");
 
-  await new DNSListener("bar.example.com", "127.0.0.1");
+  await new DNSListener("bar.example.com", "3.3.3.3");
 });
 
 // verify that the name was put in cache - it works with bad DNS URI
 add_task(async function test2() {
   // Don't clear the cache. That is what we're checking.
   Services.prefs.setIntPref("network.trr.mode", 3); // TRR-only
   Services.prefs.setCharPref("network.trr.uri", `https://foo.example.com:${h2Port}/404`);
 
-  await new DNSListener("bar.example.com", "127.0.0.1");
+  await new DNSListener("bar.example.com", "3.3.3.3");
 });
 
 // verify working credentials in DOH request
 add_task(async function test3() {
   dns.clearCache(true);
   Services.prefs.setIntPref("network.trr.mode", 3); // TRR-only
-  Services.prefs.setCharPref("network.trr.uri", `https://foo.example.com:${h2Port}/dns-auth`);
+  Services.prefs.setCharPref("network.trr.uri", `https://foo.example.com:${h2Port}/doh?responseIP=4.4.4.4&auth=true`);
   Services.prefs.setCharPref("network.trr.credentials", "user:password");
 
-  await new DNSListener("bar.example.com", "127.0.0.1");
+  await new DNSListener("bar.example.com", "4.4.4.4");
 });
 
 // verify failing credentials in DOH request
 add_task(async function test4() {
   dns.clearCache(true);
   Services.prefs.setIntPref("network.trr.mode", 3); // TRR-only
-  Services.prefs.setCharPref("network.trr.uri", `https://foo.example.com:${h2Port}/dns-auth`);
+  Services.prefs.setCharPref("network.trr.uri", `https://foo.example.com:${h2Port}/doh?responseIP=4.4.4.4&auth=true`);
   Services.prefs.setCharPref("network.trr.credentials", "evil:person");
 
   let [, , inStatus] = await new DNSListener("wrong.example.com", undefined, false);
   Assert.ok(!Components.isSuccessCode(inStatus), `${inStatus} should be an error code`);
 });
 
 // verify DOH push, part A
 add_task(async function test5() {
   dns.clearCache(true);
   Services.prefs.setIntPref("network.trr.mode", 3); // TRR-only
-  Services.prefs.setCharPref("network.trr.uri", `https://foo.example.com:${h2Port}/dns-push`);
+  Services.prefs.setCharPref("network.trr.uri", `https://foo.example.com:${h2Port}/doh?responseIP=5.5.5.5&push=true`);
 
-  await new DNSListener("first.example.com", "127.0.0.1");
+  await new DNSListener("first.example.com", "5.5.5.5");
 });
 
 add_task(async function test5b() {
   // At this point the second host name should've been pushed and we can resolve it using
   // cache only. Set back the URI to a path that fails.
   // Don't clear the cache, otherwise we lose the pushed record.
   Services.prefs.setCharPref("network.trr.uri", `https://foo.example.com:${h2Port}/404`);
   dump("test5b - resolve push.example.now please\n");
 
   await new DNSListener("push.example.com", "2018::2018");
 });
 
 // verify AAAA entry
 add_task(async function test6() {
   dns.clearCache(true);
   Services.prefs.setIntPref("network.trr.mode", 3); // TRR-only
-  Services.prefs.setCharPref("network.trr.uri", `https://foo.example.com:${h2Port}/dns-aaaa`);
+  Services.prefs.setCharPref("network.trr.uri", `https://foo.example.com:${h2Port}/doh?responseIP=2020:2020::2020`);
   await new DNSListener("aaaa.example.com", "2020:2020::2020");
 });
 
 // verify RFC1918 address from the server is rejected
 add_task(async function test7() {
   dns.clearCache(true);
   Services.prefs.setIntPref("network.trr.mode", 3); // TRR-only
-  Services.prefs.setCharPref("network.trr.uri", `https://foo.example.com:${h2Port}/dns-rfc1918`);
+  Services.prefs.setCharPref("network.trr.uri", `https://foo.example.com:${h2Port}/doh?responseIP=192.168.0.1`);
   let [, , inStatus] = await new DNSListener("rfc1918.example.com", undefined, false);
   Assert.ok(!Components.isSuccessCode(inStatus), `${inStatus} should be an error code`);
 });
 
 // verify RFC1918 address from the server is fine when told so
 add_task(async function test8() {
   dns.clearCache(true);
   Services.prefs.setIntPref("network.trr.mode", 3); // TRR-only
-  Services.prefs.setCharPref("network.trr.uri", `https://foo.example.com:${h2Port}/dns-rfc1918`);
+  Services.prefs.setCharPref("network.trr.uri", `https://foo.example.com:${h2Port}/doh?responseIP=192.168.0.1`);
   Services.prefs.setBoolPref("network.trr.allow-rfc1918", true);
   await new DNSListener("rfc1918.example.com", "192.168.0.1");
 });
 
 // use GET and disable ECS (makes a larger request)
 // verify URI template cutoff
 add_task(async function test8b() {
   dns.clearCache(true);
   Services.prefs.setIntPref("network.trr.mode", 3); // TRR-only
-  Services.prefs.setCharPref("network.trr.uri", `https://foo.example.com:${h2Port}/dns-ecs{?dns}`);
+  Services.prefs.setCharPref("network.trr.uri", `https://foo.example.com:${h2Port}/doh{?dns}`);
   Services.prefs.clearUserPref("network.trr.allow-rfc1918");
   Services.prefs.setBoolPref("network.trr.useGET", true);
   Services.prefs.setBoolPref("network.trr.disable-ECS", true);
   await new DNSListener("ecs.example.com", "5.5.5.5");
 });
 
 // use GET
 add_task(async function test9() {
   dns.clearCache(true);
   Services.prefs.setIntPref("network.trr.mode", 3); // TRR-only
-  Services.prefs.setCharPref("network.trr.uri", `https://foo.example.com:${h2Port}/dns-get`);
+  Services.prefs.setCharPref("network.trr.uri", `https://foo.example.com:${h2Port}/doh`);
   Services.prefs.clearUserPref("network.trr.allow-rfc1918");
   Services.prefs.setBoolPref("network.trr.useGET", true);
   Services.prefs.setBoolPref("network.trr.disable-ECS", false);
-  await new DNSListener("get.example.com", "1.2.3.4");
+  await new DNSListener("get.example.com", "5.5.5.5");
 });
 
 // confirmationNS set without confirmed NS yet
 // NOTE: this requires test9 to run before, as the http2 server resets state there
 add_task(async function test10() {
   dns.clearCache(true);
   Services.prefs.setIntPref("network.trr.mode", 3); // TRR-only
   Services.prefs.clearUserPref("network.trr.useGET");
@@ -357,18 +357,18 @@ add_task(async function test20() {
 // TRR-shadow and a CNAME loop
 add_task(async function test21() {
   dns.clearCache(true);
   Services.prefs.setIntPref("network.trr.mode", 4); // shadow
   Services.prefs.setCharPref("network.trr.uri", `https://foo.example.com:${h2Port}/dns-cname-loop`);
   await new DNSListener("test21.example.com", "127.0.0.1");
 });
 
-// verify that basic A record name mismatch gets rejected. Gets the same DOH
-// response back as test1
+// verify that basic A record name mismatch gets rejected.
+// Gets a response for bar.example.com instead of what it requested
 add_task(async function test22() {
   dns.clearCache(true);
   Services.prefs.setIntPref("network.trr.mode", 3); // TRR-only to avoid native fallback
   Services.prefs.setCharPref("network.trr.uri", `https://foo.example.com:${h2Port}/dns`);
   let [, , inStatus] = await new DNSListener("mismatch.example.com", undefined, false);
   Assert.ok(!Components.isSuccessCode(inStatus), `${inStatus} should be an error code`);
 });
 
@@ -380,17 +380,17 @@ add_task(async function test23() {
   await new DNSListener("cname-a.example.com", "9.8.7.6");
 });
 
 // TRR-first check that TRR result is used
 add_task(async function test24() {
   dns.clearCache(true);
   Services.prefs.setIntPref("network.trr.mode", 2); // TRR-first
   Services.prefs.setCharPref("network.trr.excluded-domains", "");
-  Services.prefs.setCharPref("network.trr.uri", `https://foo.example.com:${h2Port}/dns-ip`);
+  Services.prefs.setCharPref("network.trr.uri", `https://foo.example.com:${h2Port}/doh?responseIP=192.192.192.192`);
   await new DNSListener("bar.example.com", "192.192.192.192");
 });
 
 // TRR-first check that DNS result is used if domain is part of the excluded-domains pref
 add_task(async function test24b() {
   dns.clearCache(true);
   Services.prefs.setCharPref("network.trr.excluded-domains", "bar.example.com");
   await new DNSListener("bar.example.com", "127.0.0.1");
@@ -398,48 +398,48 @@ add_task(async function test24b() {
 
 // TRR-first check that DNS result is used if domain is part of the excluded-domains pref
 add_task(async function test24c() {
   dns.clearCache(true);
   Services.prefs.setCharPref("network.trr.excluded-domains", "example.com");
   await new DNSListener("bar.example.com", "127.0.0.1");
 });
 
-// TRR-only check that localhost doesn't work if not in the excluded-domains list
+// TRR-only that resolving localhost with TRR-only mode will use the remote
+// resolver if it's not in the excluded domains
 add_task(async function test25() {
   dns.clearCache(true);
   Services.prefs.setIntPref("network.trr.mode", 3); // TRR-only
   Services.prefs.setCharPref("network.trr.excluded-domains", "");
-  Services.prefs.setCharPref("network.trr.uri", `https://foo.example.com:${h2Port}/dns-ip`);
+  Services.prefs.setCharPref("network.trr.uri", `https://foo.example.com:${h2Port}/doh?responseIP=192.192.192.192`);
 
-  let [, , inStatus] = await new DNSListener("localhost", "127.0.0.1", false);
-  Assert.ok(!Components.isSuccessCode(inStatus), `${inStatus} should be an error code`);
+  await new DNSListener("localhost", "192.192.192.192", true);
 });
 
 // TRR-only check that localhost goes directly to native lookup when in the excluded-domains
 add_task(async function test25b() {
   dns.clearCache(true);
   Services.prefs.setIntPref("network.trr.mode", 3); // TRR-only
   Services.prefs.setCharPref("network.trr.excluded-domains", "localhost");
-  Services.prefs.setCharPref("network.trr.uri", `https://foo.example.com:${h2Port}/dns-ip`);
+  Services.prefs.setCharPref("network.trr.uri", `https://foo.example.com:${h2Port}/doh?responseIP=192.192.192.192`);
 
   await new DNSListener("localhost", "127.0.0.1");
 });
 
 // TRR-only check that test.local is resolved via native DNS
 add_task(async function test25c() {
   dns.clearCache(true);
   Services.prefs.setIntPref("network.trr.mode", 3); // TRR-only
   Services.prefs.setCharPref("network.trr.excluded-domains", "localhost,local");
-  Services.prefs.setCharPref("network.trr.uri", `https://foo.example.com:${h2Port}/dns-ip`);
+  Services.prefs.setCharPref("network.trr.uri", `https://foo.example.com:${h2Port}/doh?responseIP=192.192.192.192`);
 
   await new DNSListener("test.local", "127.0.0.1");
 });
 
 // TRR-only check that .other is resolved via native DNS when the pref is set
 add_task(async function test25d() {
   dns.clearCache(true);
   Services.prefs.setIntPref("network.trr.mode", 3); // TRR-only
   Services.prefs.setCharPref("network.trr.excluded-domains", "localhost,local,other");
-  Services.prefs.setCharPref("network.trr.uri", `https://foo.example.com:${h2Port}/dns-ip`);
+  Services.prefs.setCharPref("network.trr.uri", `https://foo.example.com:${h2Port}/doh?responseIP=192.192.192.192`);
 
   await new DNSListener("domain.other", "127.0.0.1");
 });
--- a/testing/xpcshell/moz-http2/moz-http2.js
+++ b/testing/xpcshell/moz-http2/moz-http2.js
@@ -8,16 +8,18 @@
 var node_http2_root = '../node-http2';
 if (process.env.NODE_HTTP2_ROOT) {
   node_http2_root = process.env.NODE_HTTP2_ROOT;
 }
 var http2 = require(node_http2_root);
 var fs = require('fs');
 var url = require('url');
 var crypto = require('crypto');
+const dnsPacket = require('../dns-packet');
+const ip = require('../node-ip');
 
 // Hook into the decompression code to log the decompressed name-value pairs
 var compression_module = node_http2_root + "/lib/protocol/compressor";
 var http2_compression = require(compression_module);
 var HeaderSetDecompressor = http2_compression.HeaderSetDecompressor;
 var originalRead = HeaderSetDecompressor.prototype.read;
 var lastDecompressor;
 var decompressedPairs;
@@ -545,16 +547,107 @@ function handleRequest(req, res) {
     res.setHeader('Content-Type', 'application/dns-message');
     res.setHeader('Content-Length', content.length);
     res.writeHead(200);
     res.write(content);
     res.end("");
     return;
 
   }
+  else if (u.pathname == "/doh") {
+    ns_confirm = 0; // back to first reply for dns-confirm
+    cname_confirm = 0; // back to first reply for dns-cname
+
+    let params = new url.URL(`http://localhost${req.url}`).searchParams;
+    let responseIP = params.get("responseIP");
+    if (!responseIP) {
+      responseIP = "5.5.5.5";
+    }
+
+    if (params.get("auth")) {
+      // There's a Set-Cookie: header in the response for "/dns" , which this
+      // request subsequently would include if the http channel wasn't
+      // anonymous. Thus, if there's a cookie in this request, we know Firefox
+      // mishaved. If there's not, we're fine.
+      if (req.headers['cookie']) {
+        res.writeHead(403);
+        res.end("cookie for me, not for you");
+        return;
+      }
+      if (req.headers['authorization'] != "user:password") {
+        res.writeHead(401);
+        res.end("bad boy!");
+        return;
+      }
+    }
+
+    if (params.get("push")) {
+      // push.example.com has AAAA entry 2018::2018
+      var pcontent= new Buffer("0000010000010001000000000470757368076578616D706C6503636F6D00001C0001C00C001C000100000037001020180000000000000000000000002018", "hex");
+      push = res.push({
+        hostname: 'foo.example.com:' + serverPort,
+        port: serverPort,
+        path: '/dns-pushed-response?dns=AAAAAAABAAAAAAAABHB1c2gHZXhhbXBsZQNjb20AABwAAQ',
+        method: 'GET',
+        headers: {
+          'accept' : 'application/dns-message'
+        }
+      });
+      push.writeHead(200, {
+        'content-type': 'application/dns-message',
+        'pushed' : 'yes',
+        'content-length' : pcontent.length,
+        'X-Connection-Http2': 'yes'
+      });
+      push.end(pcontent);
+    }
+
+    let payload = new Buffer("");
+
+    function emitResponse(response, requestPayload) {
+      let packet = dnsPacket.decode(requestPayload);
+
+      let buf = dnsPacket.encode({
+        type: 'query',
+        id: packet.id,
+        flags: dnsPacket.RECURSION_DESIRED,
+        questions: packet.questions,
+        answers: [{
+          name: packet.questions[0].name,
+          ttl: 55,
+          type: ip.isV4Format(responseIP) ? "A" : "AAAA",
+          flush: false,
+          data: responseIP,
+        }],
+      });
+
+      response.setHeader('Content-Length', buf.length);
+      response.setHeader('Set-Cookie', 'trackyou=yes; path=/; max-age=100000;');
+      response.setHeader('Content-Type', 'application/dns-message');
+      response.writeHead(200);
+      response.write(buf);
+      response.end("");
+      return;
+    }
+
+    if (params.get("dns")) {
+      payload = Buffer.from(params.get("dns"), 'base64');
+      emitResponse(res, payload);
+      return;
+    }
+
+    req.on('data', function receiveData(chunk) {
+      payload = Buffer.concat([payload, chunk]);
+    });
+    req.on('end', function finishedData() {
+      emitResponse(res, payload);
+      return;
+    });
+    return;
+  }
   else if (u.pathname === "/dns-cname-a") {
     // test23 asks for cname-a.example.com
     // this responds with a CNAME to here.example.com *and* an A record
     // for here.example.com
     var content;
 
     content = new Buffer("0000" +
                          "0100" +
@@ -599,67 +692,16 @@ function handleRequest(req, res) {
     res.setHeader('Content-Type', 'application/dns-message');
     res.setHeader('Content-Length', content.length);
     res.writeHead(200);
     res.write(content);
     res.end("");
     return;
 
   }
-    // for use with test_trr.js, test8b
-  else if (u.path === "/dns-ecs?dns=AAABAAABAAAAAAABA2VjcwdleGFtcGxlA2NvbQAAAQABAAApEAAAAAAAAAgACAAEAAEAAA") {
-    // the query string asks for an A entry for ecs.example.com
-    // ecs.example.com has A entry 5.5.5.5
-    var content= new Buffer("00000100000100010000000003656373076578616D706C6503636F6D0000010001C00C0001000100000037000405050505", "hex");
-    res.setHeader('Content-Type', 'application/dns-message');
-    res.setHeader('Content-Length', content.length);
-    res.writeHead(200);
-    res.write(content);
-    res.end("");
-    return;
-  }
-  // for use with test_trr.js
-  else if (u.path === "/dns-get?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-message');
-    res.setHeader('Content-Length', content.length);
-    res.writeHead(200);
-    res.write(content);
-    res.end("");
-    ns_confirm = 0; // back to first reply for dns-confirm
-    cname_confirm = 0; // back to first reply for dns-cname
-    return;
-  }
-  // for use with test_trr.js
-  else if (u.pathname === "/dns") {
-    // bar.example.com has A entry 127.0.0.1
-    var content= new Buffer("00000100000100010000000003626172076578616D706C6503636F6D0000010001C00C000100010000003700047F000001", "hex");
-    res.setHeader('Content-Type', 'application/dns-message');
-    res.setHeader('Content-Length', content.length);
-    // pass back a cookie here, check it in /dns-auth
-    res.setHeader('Set-Cookie', 'trackyou=yes; path=/; max-age=100000;');
-    res.writeHead(200);
-    res.write(content);
-    res.end("");
-    return;
-  }
-  else if (u.pathname === "/dns-ip") {
-    // bar.example.com has A entry 192.192.192.192
-    var content= new Buffer("00000100000100010000000003626172076578616D706C6503636F6D0000010001C00C00010001000000370004C0C0C0C0", "hex");
-    res.setHeader('Content-Type', 'application/dns-message');
-    res.setHeader('Content-Length', content.length);
-    // pass back a cookie here, check it in /dns-auth
-    res.setHeader('Set-Cookie', 'trackyou=yes; path=/; max-age=100000;');
-    res.writeHead(200);
-    res.write(content);
-    res.end("");
-    return;
-  }
   else if (u.pathname === "/dns-ns") {
     // confirm.example.com has NS entry ns.example.com
     var content= new Buffer("00000100000100010000000007636F6E6669726D076578616D706C6503636F6D0000020001C00C00020001000000370012026E73076578616D706C6503636F6D010A00", "hex");
     res.setHeader('Content-Type', 'application/dns-message');
     res.setHeader('Content-Length', content.length);
     res.writeHead(200);
     res.write(content);
     res.end("");
@@ -689,92 +731,16 @@ function handleRequest(req, res) {
     }
     res.setHeader('Content-Type', 'application/dns-message');
     res.setHeader('Content-Length', content.length);
     res.writeHead(200);
     res.write(content);
     res.end("");
     return;
   }
-  // for use with test_trr.js
-  else if (u.pathname === "/dns-aaaa") {
-    // aaaa.example.com has AAAA entry 2020:2020::2020
-    var content= new Buffer("0000010000010001000000000461616161076578616D706C6503636F6D00001C0001C00C001C000100000037001020202020000000000000000000002020", "hex");
-    res.setHeader('Content-Type', 'application/dns-message');
-    res.setHeader('Content-Length', content.length);
-    res.writeHead(200);
-    res.write(content);
-    res.end("");
-    return;
-  }
-  else if (u.pathname === "/dns-rfc1918") {
-    // rfc1918.example.com has A entry 192.168.0.1
-    var content= new Buffer("0000010000010001000000000772666331393138076578616D706C6503636F6D0000010001C00C00010001000000370004C0A80001", "hex");
-    res.setHeader('Content-Type', 'application/dns-message');
-    res.setHeader('Content-Length', content.length);
-    res.writeHead(200);
-    res.write(content);
-    res.end("");
-    return;
-  }
-  // for use with test_trr.js
-  else if (u.pathname === "/dns-push") {
-    // first.example.com has A entry 127.0.0.1
-    var content= new Buffer("000001000001000100000000056669727374076578616D706C6503636F6D0000010001C00C000100010000003700047F000001", "hex");
-    // push.example.com has AAAA entry 2018::2018
-    var pcontent= new Buffer("0000010000010001000000000470757368076578616D706C6503636F6D00001C0001C00C001C000100000037001020180000000000000000000000002018", "hex");
-    push = res.push({
-      hostname: 'foo.example.com:' + serverPort,
-      port: serverPort,
-      path: '/dns-pushed-response?dns=AAAAAAABAAAAAAAABHB1c2gHZXhhbXBsZQNjb20AABwAAQ',
-      method: 'GET',
-      headers: {
-        'accept' : 'application/dns-message'
-      }
-    });
-    push.writeHead(200, {
-      'content-type': 'application/dns-message',
-      'pushed' : 'yes',
-      'content-length' : pcontent.length,
-      'X-Connection-Http2': 'yes'
-    });
-    push.end(pcontent);
-    res.setHeader('Content-Type', 'application/dns-message');
-    res.setHeader('Content-Length', content.length);
-    res.writeHead(200);
-    res.write(content);
-    res.end("");
-    return;
-  }
-  // for use with test_trr.js
-  else if (u.pathname === "/dns-auth") {
-    // There's a Set-Cookie: header in the response for "/dns" , which this
-    // request subsequently would include if the http channel wasn't
-    // anonymous. Thus, if there's a cookie in this request, we know Firefox
-    // mishaved. If there's not, we're fine.
-    if (req.headers['cookie']) {
-      res.writeHead(403);
-      res.end("cookie for me, not for you");
-      return;
-    }
-    if (req.headers['authorization'] != "user:password") {
-      res.writeHead(401);
-      res.end("bad boy!");
-      return;
-    }
-    // bar.example.com has A entry 127.0.0.1
-    var content= new Buffer("00000100000100010000000003626172076578616D706C6503636F6D0000010001C00C000100010000003700047F000001", "hex");
-    res.setHeader('Content-Type', 'application/dns-message');
-    res.setHeader('Content-Length', content.length);
-    res.writeHead(200);
-    res.write(content);
-    res.end("");
-    return;
-  }
-
   // for use with test_esni_dns_fetch.js
   else if (u.pathname === "/esni-dns") {
     content = new Buffer("0000" +
                          "8180" +
                          "0001" + // QDCOUNT
                          "0001" + // ANCOUNT
                          "00000000" + // NSCOUNT + ARCOUNT
                          "055F65736E69076578616D706C6503636F6D00" + // _esni.example.com