зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1635566 - TRR: Perform a case-insensitive match for the host name r=necko-reviewers,dragana
This is according to RFC 4343 : Domain Name System (DNS) Case Insensitivity Clarification Differential Revision: https://phabricator.services.mozilla.com/D75081
This commit is contained in:
Родитель
681c9b474e
Коммит
7a0dc7cc47
|
@ -873,10 +873,14 @@ nsresult TRR::DohDecode(nsCString& aHost) {
|
|||
return NS_ERROR_ILLEGAL_VALUE;
|
||||
}
|
||||
|
||||
// We check if the qname matches the host or the FQDN version of the host
|
||||
if (qname.Equals(aHost) ||
|
||||
(aHost.Length() == qname.Length() + 1 && aHost.Last() == '.' &&
|
||||
StringBeginsWith(aHost, qname))) {
|
||||
// We check if the qname is a case-insensitive match for the host or the
|
||||
// FQDN version of the host
|
||||
bool responseMatchesQuestion =
|
||||
(qname.Length() == aHost.Length() ||
|
||||
(aHost.Length() == qname.Length() + 1 && aHost.Last() == '.')) &&
|
||||
qname.Compare(aHost.BeginReading(), true, qname.Length()) == 0;
|
||||
|
||||
if (responseMatchesQuestion) {
|
||||
// RDATA
|
||||
// - A (TYPE 1): 4 bytes
|
||||
// - AAAA (TYPE 28): 16 bytes
|
||||
|
|
|
@ -125,5 +125,17 @@ add_task(async function test_trr_casing() {
|
|||
]);
|
||||
await new TRRDNSListener("a.test.com", "8.8.8.8");
|
||||
|
||||
await trrServer.registerDoHAnswers("CAPITAL.COM", "A", [
|
||||
{
|
||||
name: "capital.com",
|
||||
ttl: 55,
|
||||
type: "A",
|
||||
flush: false,
|
||||
data: "2.2.2.2",
|
||||
},
|
||||
]);
|
||||
await new TRRDNSListener("CAPITAL.COM", "2.2.2.2");
|
||||
await new TRRDNSListener("CAPITAL.COM.", "2.2.2.2");
|
||||
|
||||
await trrServer.stop();
|
||||
});
|
||||
|
|
Загрузка…
Ссылка в новой задаче