зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1659699 - HTTPSSVC: Special handling of "." in TargetName r=necko-reviewers,kershaw
Differential Revision: https://phabricator.services.mozilla.com/D88286
This commit is contained in:
Родитель
dde737671d
Коммит
836481e674
|
@ -1038,6 +1038,19 @@ nsresult TRR::DohDecode(nsCString& aHost) {
|
|||
return rv;
|
||||
}
|
||||
|
||||
if (parsed.mSvcDomainName.IsEmpty()) {
|
||||
if (parsed.mSvcFieldPriority == 0) {
|
||||
// For AliasMode SVCB RRs, a TargetName of "." indicates that the
|
||||
// service is not available or does not exist.
|
||||
continue;
|
||||
}
|
||||
|
||||
// For ServiceMode SVCB RRs, if TargetName has the value ".",
|
||||
// then the owner name of this record MUST be used as
|
||||
// the effective TargetName.
|
||||
parsed.mSvcDomainName = qname;
|
||||
}
|
||||
|
||||
available -= (svcbIndex - index);
|
||||
if (!available.isValid()) {
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
|
|
|
@ -166,7 +166,7 @@ add_task(async function testHTTPSSVC() {
|
|||
"got correct answer"
|
||||
);
|
||||
Assert.equal(answer[1].priority, 2);
|
||||
Assert.equal(answer[1].name, "");
|
||||
Assert.equal(answer[1].name, "test.httpssvc.com");
|
||||
Assert.equal(answer[1].values.length, 4);
|
||||
Assert.equal(
|
||||
answer[1].values[0].QueryInterface(Ci.nsISVCParamAlpn).alpn,
|
||||
|
@ -591,4 +591,67 @@ add_task(async function test_aliasform() {
|
|||
[inRequest, inRecord, inStatus2] = await listener;
|
||||
Assert.equal(inRequest, request, "correct request was used");
|
||||
Assert.ok(Components.isSuccessCode(inStatus2), `${inStatus2} should succeed`);
|
||||
|
||||
// alias-mode with . targetName
|
||||
await trrServer.registerDoHAnswers("no-alias.com", "HTTPS", [
|
||||
{
|
||||
name: "no-alias.com",
|
||||
ttl: 55,
|
||||
type: "HTTPS",
|
||||
flush: false,
|
||||
data: {
|
||||
priority: 0,
|
||||
name: ".",
|
||||
values: [],
|
||||
},
|
||||
},
|
||||
]);
|
||||
|
||||
listener = new DNSListener();
|
||||
request = dns.asyncResolve(
|
||||
"no-alias.com",
|
||||
dns.RESOLVE_TYPE_HTTPSSVC,
|
||||
0,
|
||||
null, // resolverInfo
|
||||
listener,
|
||||
mainThread,
|
||||
defaultOriginAttributes
|
||||
);
|
||||
|
||||
[inRequest, inRecord, inStatus2] = await listener;
|
||||
Assert.equal(inRequest, request, "correct request was used");
|
||||
Assert.ok(!Components.isSuccessCode(inStatus2), `${inStatus2} should fail`);
|
||||
|
||||
// service-mode with . targetName
|
||||
await trrServer.registerDoHAnswers("service.com", "HTTPS", [
|
||||
{
|
||||
name: "service.com",
|
||||
ttl: 55,
|
||||
type: "HTTPS",
|
||||
flush: false,
|
||||
data: {
|
||||
priority: 1,
|
||||
name: ".",
|
||||
values: [{ key: "alpn", value: "h2,h3" }],
|
||||
},
|
||||
},
|
||||
]);
|
||||
|
||||
listener = new DNSListener();
|
||||
request = dns.asyncResolve(
|
||||
"service.com",
|
||||
dns.RESOLVE_TYPE_HTTPSSVC,
|
||||
0,
|
||||
null, // resolverInfo
|
||||
listener,
|
||||
mainThread,
|
||||
defaultOriginAttributes
|
||||
);
|
||||
|
||||
[inRequest, inRecord, inStatus2] = await listener;
|
||||
Assert.equal(inRequest, request, "correct request was used");
|
||||
Assert.ok(Components.isSuccessCode(inStatus2), `${inStatus2} should work`);
|
||||
let answer = inRecord.QueryInterface(Ci.nsIDNSHTTPSSVCRecord).records;
|
||||
Assert.equal(answer[0].priority, 1);
|
||||
Assert.equal(answer[0].name, "service.com");
|
||||
});
|
||||
|
|
Загрузка…
Ссылка в новой задаче