зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1542561 - Test that a IPv4 NXDOMAIN still uses the IPv6 response, regardless which one comes back first r=dragana
This test uses prefs added in Bug 1518730, but the pref is ignored when it doesn't exist, so the test is still valid. Depends on D33471 Differential Revision: https://phabricator.services.mozilla.com/D33473 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
15ababeb71
Коммит
1bb0e080b4
|
@ -31,6 +31,8 @@ add_task(function setup() {
|
|||
// 0 - off, 1 - reserved, 2 - TRR first, 3 - TRR only, 4 - reserved
|
||||
Services.prefs.setIntPref("network.trr.mode", 2); // TRR first
|
||||
Services.prefs.setBoolPref("network.trr.wait-for-portal", false);
|
||||
// By default wait for all responses before notifying the listeners.
|
||||
Services.prefs.setBoolPref("network.trr.wait-for-A-and-AAAA", true);
|
||||
// don't confirm that TRR is working, just go!
|
||||
Services.prefs.setCharPref("network.trr.confirmationNS", "skip");
|
||||
|
||||
|
@ -54,6 +56,8 @@ registerCleanupFunction(() => {
|
|||
Services.prefs.clearUserPref("network.trr.request-timeout");
|
||||
Services.prefs.clearUserPref("network.trr.disable-ECS");
|
||||
Services.prefs.clearUserPref("network.trr.early-AAAA");
|
||||
Services.prefs.clearUserPref("network.trr.skip-AAAA-when-not-supported");
|
||||
Services.prefs.clearUserPref("network.trr.wait-for-A-and-AAAA");
|
||||
Services.prefs.clearUserPref("network.trr.excluded-domains");
|
||||
|
||||
Services.prefs.clearUserPref("network.http.spdy.enabled");
|
||||
|
@ -173,8 +177,67 @@ add_task(async function test5b() {
|
|||
|
||||
// verify AAAA entry
|
||||
add_task(async function test6() {
|
||||
dns.clearCache(true);
|
||||
|
||||
Services.prefs.setBoolPref("network.trr.wait-for-A-and-AAAA", true);
|
||||
|
||||
dns.clearCache(true);
|
||||
Services.prefs.setBoolPref("network.trr.early-AAAA", true); // ignored when wait-for-A-and-AAAA is true
|
||||
Services.prefs.setIntPref("network.trr.mode", 3); // TRR-only
|
||||
Services.prefs.setCharPref("network.trr.uri", `https://foo.example.com:${h2Port}/doh?responseIP=2020:2020::2020&delayIPv4=100`);
|
||||
await new DNSListener("aaaa.example.com", "2020:2020::2020");
|
||||
|
||||
dns.clearCache(true);
|
||||
Services.prefs.setBoolPref("network.trr.early-AAAA", false); // ignored when wait-for-A-and-AAAA is true
|
||||
Services.prefs.setCharPref("network.trr.uri", `https://foo.example.com:${h2Port}/doh?responseIP=2020:2020::2030&delayIPv4=100`);
|
||||
await new DNSListener("aaaa.example.com", "2020:2020::2030");
|
||||
|
||||
dns.clearCache(true);
|
||||
Services.prefs.setBoolPref("network.trr.early-AAAA", true); // ignored when wait-for-A-and-AAAA is true
|
||||
Services.prefs.setIntPref("network.trr.mode", 3); // TRR-only
|
||||
Services.prefs.setCharPref("network.trr.uri", `https://foo.example.com:${h2Port}/doh?responseIP=2020:2020::2020&delayIPv6=100`);
|
||||
await new DNSListener("aaaa.example.com", "2020:2020::2020");
|
||||
|
||||
dns.clearCache(true);
|
||||
Services.prefs.setBoolPref("network.trr.early-AAAA", false); // ignored when wait-for-A-and-AAAA is true
|
||||
Services.prefs.setCharPref("network.trr.uri", `https://foo.example.com:${h2Port}/doh?responseIP=2020:2020::2030&delayIPv6=100`);
|
||||
await new DNSListener("aaaa.example.com", "2020:2020::2030");
|
||||
|
||||
dns.clearCache(true);
|
||||
Services.prefs.setBoolPref("network.trr.early-AAAA", true); // ignored when wait-for-A-and-AAAA is true
|
||||
Services.prefs.setIntPref("network.trr.mode", 3); // TRR-only
|
||||
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");
|
||||
|
||||
dns.clearCache(true);
|
||||
Services.prefs.setBoolPref("network.trr.early-AAAA", false); // ignored when wait-for-A-and-AAAA is true
|
||||
Services.prefs.setCharPref("network.trr.uri", `https://foo.example.com:${h2Port}/doh?responseIP=2020:2020::2030`);
|
||||
await new DNSListener("aaaa.example.com", "2020:2020::2030");
|
||||
|
||||
Services.prefs.setBoolPref("network.trr.wait-for-A-and-AAAA", false);
|
||||
|
||||
dns.clearCache(true);
|
||||
Services.prefs.setBoolPref("network.trr.early-AAAA", true);
|
||||
Services.prefs.setIntPref("network.trr.mode", 3); // TRR-only
|
||||
Services.prefs.setCharPref("network.trr.uri", `https://foo.example.com:${h2Port}/doh?responseIP=2020:2020::2020&delayIPv4=100`);
|
||||
await new DNSListener("aaaa.example.com", "2020:2020::2020");
|
||||
|
||||
dns.clearCache(true);
|
||||
Services.prefs.setBoolPref("network.trr.early-AAAA", false);
|
||||
Services.prefs.setCharPref("network.trr.uri", `https://foo.example.com:${h2Port}/doh?responseIP=2020:2020::2030&delayIPv4=100`);
|
||||
await new DNSListener("aaaa.example.com", "2020:2020::2030");
|
||||
|
||||
dns.clearCache(true);
|
||||
Services.prefs.setBoolPref("network.trr.early-AAAA", true);
|
||||
Services.prefs.setIntPref("network.trr.mode", 3); // TRR-only
|
||||
Services.prefs.setCharPref("network.trr.uri", `https://foo.example.com:${h2Port}/doh?responseIP=2020:2020::2020&delayIPv6=100`);
|
||||
await new DNSListener("aaaa.example.com", "2020:2020::2020");
|
||||
|
||||
dns.clearCache(true);
|
||||
Services.prefs.setBoolPref("network.trr.early-AAAA", false);
|
||||
Services.prefs.setCharPref("network.trr.uri", `https://foo.example.com:${h2Port}/doh?responseIP=2020:2020::2030&delayIPv6=100`);
|
||||
await new DNSListener("aaaa.example.com", "2020:2020::2030");
|
||||
|
||||
dns.clearCache(true);
|
||||
Services.prefs.setBoolPref("network.trr.early-AAAA", true);
|
||||
Services.prefs.setIntPref("network.trr.mode", 3); // TRR-only
|
||||
Services.prefs.setCharPref("network.trr.uri", `https://foo.example.com:${h2Port}/doh?responseIP=2020:2020::2020`);
|
||||
|
@ -186,6 +249,7 @@ add_task(async function test6() {
|
|||
await new DNSListener("aaaa.example.com", "2020:2020::2030");
|
||||
|
||||
Services.prefs.clearUserPref("network.trr.early-AAAA");
|
||||
Services.prefs.clearUserPref("network.trr.wait-for-A-and-AAAA");
|
||||
});
|
||||
|
||||
// verify RFC1918 address from the server is rejected
|
||||
|
|
|
@ -661,12 +661,30 @@ function handleRequest(req, res) {
|
|||
answers: answers,
|
||||
});
|
||||
|
||||
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("");
|
||||
function writeResponse(response, buf) {
|
||||
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("");
|
||||
}
|
||||
|
||||
let delay = undefined;
|
||||
if (packet.questions[0].type == "A") {
|
||||
delay = u.query["delayIPv4"];
|
||||
} else if (packet.questions[0].type == "AAAA") {
|
||||
delay = u.query["delayIPv6"];
|
||||
}
|
||||
|
||||
if (delay) {
|
||||
setTimeout((arg) => {
|
||||
writeResponse(arg[0], arg[1]);
|
||||
}, parseInt(delay), [response, buf]);
|
||||
return;
|
||||
}
|
||||
|
||||
writeResponse(response, buf);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче