forked from mirrors/gecko-dev
Backed out changeset 9238cfd153bc (bug 1943011) for causing bug 1943722.
This commit is contained in:
parent
2abe81513e
commit
74ec3f1600
4 changed files with 39 additions and 98 deletions
|
|
@ -214,25 +214,13 @@ class AlpnComparator {
|
|||
|
||||
nsTArray<std::tuple<nsCString, SupportedAlpnRank>> SVCB::GetAllAlpn() const {
|
||||
nsTArray<std::tuple<nsCString, SupportedAlpnRank>> alpnList;
|
||||
bool shouldAddDefaultAlpn = true;
|
||||
for (const auto& value : mSvcFieldValue) {
|
||||
if (value.mValue.is<SvcParamAlpn>()) {
|
||||
for (const auto& alpn : value.mValue.as<SvcParamAlpn>().mValue) {
|
||||
auto tuple = std::make_tuple(alpn, IsAlpnSupported(alpn));
|
||||
alpnList.AppendElement(tuple);
|
||||
if (std::get<1>(tuple) == SupportedAlpnRank::HTTP_1_1) {
|
||||
shouldAddDefaultAlpn = false;
|
||||
}
|
||||
alpnList.AppendElement(std::make_tuple(alpn, IsAlpnSupported(alpn)));
|
||||
}
|
||||
} else if (value.mValue.is<SvcParamKeyNoDefaultAlpn>()) {
|
||||
// Found "no-default-alpn", so don't bother to add it.
|
||||
shouldAddDefaultAlpn = false;
|
||||
}
|
||||
}
|
||||
if (shouldAddDefaultAlpn) {
|
||||
alpnList.AppendElement(
|
||||
std::make_tuple("http/1.1"_ns, SupportedAlpnRank::HTTP_1_1));
|
||||
}
|
||||
alpnList.Sort(AlpnComparator());
|
||||
return alpnList;
|
||||
}
|
||||
|
|
@ -342,10 +330,8 @@ static bool CheckAlpnIsUsable(SupportedAlpnRank aAlpnType, bool aNoHttp2,
|
|||
return true;
|
||||
}
|
||||
|
||||
static nsTArray<SVCBWrapper> FlattenRecords(const nsTArray<SVCB>& aRecords,
|
||||
uint32_t& aH3RecordCount) {
|
||||
static nsTArray<SVCBWrapper> FlattenRecords(const nsTArray<SVCB>& aRecords) {
|
||||
nsTArray<SVCBWrapper> result;
|
||||
aH3RecordCount = 0;
|
||||
for (const auto& record : aRecords) {
|
||||
nsTArray<std::tuple<nsCString, SupportedAlpnRank>> alpnList =
|
||||
record.GetAllAlpn();
|
||||
|
|
@ -355,9 +341,6 @@ static nsTArray<SVCBWrapper> FlattenRecords(const nsTArray<SVCB>& aRecords,
|
|||
for (const auto& alpn : alpnList) {
|
||||
SVCBWrapper wrapper(record);
|
||||
wrapper.mAlpn = Some(alpn);
|
||||
if (IsHttp3(std::get<1>(alpn))) {
|
||||
aH3RecordCount++;
|
||||
}
|
||||
result.AppendElement(wrapper);
|
||||
}
|
||||
}
|
||||
|
|
@ -376,8 +359,8 @@ DNSHTTPSSVCRecordBase::GetServiceModeRecordInternal(
|
|||
aRecordsAllExcluded = false;
|
||||
nsCOMPtr<nsIDNSService> dns = do_GetService(NS_DNSSERVICE_CONTRACTID);
|
||||
uint32_t h3ExcludedCount = 0;
|
||||
uint32_t h3RecordCount = 0;
|
||||
nsTArray<SVCBWrapper> records = FlattenRecords(aRecords, h3RecordCount);
|
||||
|
||||
nsTArray<SVCBWrapper> records = FlattenRecords(aRecords);
|
||||
for (const auto& record : records) {
|
||||
if (record.mRecord.mSvcFieldPriority == 0) {
|
||||
// In ServiceMode, the SvcPriority should never be 0.
|
||||
|
|
@ -438,7 +421,7 @@ DNSHTTPSSVCRecordBase::GetServiceModeRecordInternal(
|
|||
|
||||
// If all records are in http3 excluded list, try again without checking the
|
||||
// excluded list. This is better than returning nothing.
|
||||
if (h3ExcludedCount == h3RecordCount && aCheckHttp3ExcludedList) {
|
||||
if (h3ExcludedCount == records.Length() && aCheckHttp3ExcludedList) {
|
||||
return GetServiceModeRecordInternal(aNoHttp2, aNoHttp3, aRecords,
|
||||
aRecordsAllExcluded, false);
|
||||
}
|
||||
|
|
@ -471,8 +454,7 @@ void DNSHTTPSSVCRecordBase::GetAllRecordsWithEchConfigInternal(
|
|||
}
|
||||
|
||||
uint32_t h3ExcludedCount = 0;
|
||||
uint32_t h3RecordCount = 0;
|
||||
nsTArray<SVCBWrapper> records = FlattenRecords(aRecords, h3RecordCount);
|
||||
nsTArray<SVCBWrapper> records = FlattenRecords(aRecords);
|
||||
for (const auto& record : records) {
|
||||
if (record.mRecord.mSvcFieldPriority == 0) {
|
||||
// This should not happen, since GetAllRecordsWithEchConfigInternal()
|
||||
|
|
@ -511,7 +493,7 @@ void DNSHTTPSSVCRecordBase::GetAllRecordsWithEchConfigInternal(
|
|||
|
||||
// If all records are in http3 excluded list, try again without checking the
|
||||
// excluded list. This is better than returning nothing.
|
||||
if (h3ExcludedCount == h3RecordCount && aCheckHttp3ExcludedList) {
|
||||
if (h3ExcludedCount == records.Length() && aCheckHttp3ExcludedList) {
|
||||
GetAllRecordsWithEchConfigInternal(
|
||||
aNoHttp2, aNoHttp3, aRecords, aAllRecordsHaveEchConfig,
|
||||
aAllRecordsInH3ExcludedList, aResult, false);
|
||||
|
|
|
|||
|
|
@ -211,7 +211,6 @@ add_task(async function testFastfallback() {
|
|||
name: "test.fastfallback1.com",
|
||||
values: [
|
||||
{ key: "alpn", value: "h3-29" },
|
||||
{ key: "no-default-alpn" },
|
||||
{ key: "port", value: h3Port },
|
||||
{ key: "echconfig", value: "456..." },
|
||||
],
|
||||
|
|
@ -301,7 +300,6 @@ add_task(async function testFastfallback1() {
|
|||
name: "test.fastfallback1.org",
|
||||
values: [
|
||||
{ key: "alpn", value: "h3-29" },
|
||||
{ key: "no-default-alpn" },
|
||||
{ key: "port", value: h3Port },
|
||||
{ key: "echconfig", value: "456..." },
|
||||
],
|
||||
|
|
|
|||
|
|
@ -74,10 +74,7 @@ add_task(async function testEchConfigEnabled() {
|
|||
data: {
|
||||
priority: 1,
|
||||
name: "test.bar_1.com",
|
||||
values: [
|
||||
{ key: "alpn", value: ["h3-29"] },
|
||||
{ key: "no-default-alpn" },
|
||||
],
|
||||
values: [{ key: "alpn", value: ["h3-29"] }],
|
||||
},
|
||||
},
|
||||
{
|
||||
|
|
@ -116,11 +113,7 @@ add_task(async function testEchConfigEnabled() {
|
|||
expectedName: "test.bar_1.com",
|
||||
expectedAlpn: "h3-29",
|
||||
});
|
||||
checkResult(inRecord, true, true, {
|
||||
expectedPriority: 2,
|
||||
expectedName: "test.bar_2.com",
|
||||
expectedAlpn: "http/1.1",
|
||||
});
|
||||
checkResult(inRecord, true, true);
|
||||
|
||||
Services.prefs.setBoolPref("network.dns.echconfig.enabled", true);
|
||||
Services.dns.clearCache(true);
|
||||
|
|
@ -140,15 +133,11 @@ add_task(async function testEchConfigEnabled() {
|
|||
expectedAlpn: "h2",
|
||||
});
|
||||
checkResult(inRecord, true, false, {
|
||||
expectedPriority: 2,
|
||||
expectedName: "test.bar_2.com",
|
||||
expectedAlpn: "http/1.1",
|
||||
});
|
||||
checkResult(inRecord, true, true, {
|
||||
expectedPriority: 2,
|
||||
expectedName: "test.bar_2.com",
|
||||
expectedAlpn: "http/1.1",
|
||||
expectedPriority: 1,
|
||||
expectedName: "test.bar_1.com",
|
||||
expectedAlpn: "h3-29",
|
||||
});
|
||||
checkResult(inRecord, true, true);
|
||||
|
||||
await trrServer.stop();
|
||||
trrServer = null;
|
||||
|
|
@ -186,7 +175,6 @@ add_task(async function testTwoRecordsHaveEchConfig() {
|
|||
name: "test.foo_h3.com",
|
||||
values: [
|
||||
{ key: "alpn", value: ["h3"] },
|
||||
{ key: "no-default-alpn" },
|
||||
{ key: "echconfig", value: "456..." },
|
||||
],
|
||||
},
|
||||
|
|
@ -223,15 +211,11 @@ add_task(async function testTwoRecordsHaveEchConfig() {
|
|||
expectedAlpn: "h2",
|
||||
});
|
||||
checkResult(inRecord, true, false, {
|
||||
expectedPriority: 2,
|
||||
expectedName: "test.foo_h2.com",
|
||||
expectedAlpn: "http/1.1",
|
||||
});
|
||||
checkResult(inRecord, true, true, {
|
||||
expectedPriority: 2,
|
||||
expectedName: "test.foo_h2.com",
|
||||
expectedAlpn: "http/1.1",
|
||||
expectedPriority: 1,
|
||||
expectedName: "test.foo_h3.com",
|
||||
expectedAlpn: "h3",
|
||||
});
|
||||
checkResult(inRecord, true, true);
|
||||
|
||||
Services.prefs.setBoolPref("network.dns.http3_echconfig.enabled", true);
|
||||
Services.dns.clearCache(true);
|
||||
|
|
@ -254,11 +238,7 @@ add_task(async function testTwoRecordsHaveEchConfig() {
|
|||
expectedName: "test.foo_h3.com",
|
||||
expectedAlpn: "h3",
|
||||
});
|
||||
checkResult(inRecord, true, true, {
|
||||
expectedPriority: 2,
|
||||
expectedName: "test.foo_h2.com",
|
||||
expectedAlpn: "http/1.1",
|
||||
});
|
||||
checkResult(inRecord, true, true);
|
||||
|
||||
await trrServer.stop();
|
||||
trrServer = null;
|
||||
|
|
@ -294,7 +274,6 @@ add_task(async function testTwoRecordsHaveEchConfig1() {
|
|||
name: "test.foo_h3.com",
|
||||
values: [
|
||||
{ key: "alpn", value: ["h3", "h2"] },
|
||||
{ key: "no-default-alpn" },
|
||||
{ key: "echconfig", value: "456..." },
|
||||
],
|
||||
},
|
||||
|
|
@ -401,7 +380,6 @@ add_task(async function testOneRecordsHasEchConfig() {
|
|||
name: "test.foo_h3.com",
|
||||
values: [
|
||||
{ key: "alpn", value: ["h3"] },
|
||||
{ key: "no-default-alpn" },
|
||||
{ key: "echconfig", value: "456..." },
|
||||
],
|
||||
},
|
||||
|
|
@ -439,11 +417,7 @@ add_task(async function testOneRecordsHasEchConfig() {
|
|||
expectedName: "test.foo_h3.com",
|
||||
expectedAlpn: "h3",
|
||||
});
|
||||
checkResult(inRecord, true, true, {
|
||||
expectedPriority: 2,
|
||||
expectedName: "test.foo_h2.com",
|
||||
expectedAlpn: "http/1.1",
|
||||
});
|
||||
checkResult(inRecord, true, true);
|
||||
|
||||
Services.prefs.setBoolPref("network.dns.http3_echconfig.enabled", true);
|
||||
Services.dns.clearCache(true);
|
||||
|
|
@ -466,11 +440,7 @@ add_task(async function testOneRecordsHasEchConfig() {
|
|||
expectedName: "test.foo_h3.com",
|
||||
expectedAlpn: "h3",
|
||||
});
|
||||
checkResult(inRecord, true, true, {
|
||||
expectedPriority: 2,
|
||||
expectedName: "test.foo_h2.com",
|
||||
expectedAlpn: "http/1.1",
|
||||
});
|
||||
checkResult(inRecord, true, true);
|
||||
|
||||
await trrServer.stop();
|
||||
trrServer = null;
|
||||
|
|
@ -505,7 +475,6 @@ add_task(async function testHttp3AndHttp2Pref() {
|
|||
name: "test.foo_h3.com",
|
||||
values: [
|
||||
{ key: "alpn", value: ["h3", "h2"] },
|
||||
{ key: "no-default-alpn" },
|
||||
{ key: "echconfig", value: "456..." },
|
||||
],
|
||||
},
|
||||
|
|
@ -541,23 +510,11 @@ add_task(async function testHttp3AndHttp2Pref() {
|
|||
expectedName: "test.foo_h3.com",
|
||||
expectedAlpn: "h2",
|
||||
});
|
||||
checkResult(inRecord, true, false, {
|
||||
expectedPriority: 2,
|
||||
expectedName: "test.foo_h2.com",
|
||||
expectedAlpn: "http/1.1",
|
||||
});
|
||||
checkResult(inRecord, true, true, {
|
||||
expectedPriority: 2,
|
||||
expectedName: "test.foo_h2.com",
|
||||
expectedAlpn: "http/1.1",
|
||||
});
|
||||
checkResult(inRecord, true, false);
|
||||
checkResult(inRecord, true, true);
|
||||
|
||||
Services.prefs.setBoolPref("network.http.http2.enabled", false);
|
||||
checkResult(inRecord, false, false, {
|
||||
expectedPriority: 2,
|
||||
expectedName: "test.foo_h2.com",
|
||||
expectedAlpn: "http/1.1",
|
||||
});
|
||||
checkResult(inRecord, false, false);
|
||||
|
||||
Services.prefs.setBoolPref("network.http.http3.enable", true);
|
||||
checkResult(inRecord, false, false, {
|
||||
|
|
@ -565,21 +522,13 @@ add_task(async function testHttp3AndHttp2Pref() {
|
|||
expectedName: "test.foo_h3.com",
|
||||
expectedAlpn: "h3",
|
||||
});
|
||||
checkResult(inRecord, false, true, {
|
||||
expectedPriority: 2,
|
||||
expectedName: "test.foo_h2.com",
|
||||
expectedAlpn: "http/1.1",
|
||||
});
|
||||
checkResult(inRecord, false, true);
|
||||
checkResult(inRecord, true, false, {
|
||||
expectedPriority: 1,
|
||||
expectedName: "test.foo_h3.com",
|
||||
expectedAlpn: "h3",
|
||||
});
|
||||
checkResult(inRecord, true, true, {
|
||||
expectedPriority: 2,
|
||||
expectedName: "test.foo_h2.com",
|
||||
expectedAlpn: "http/1.1",
|
||||
});
|
||||
checkResult(inRecord, true, true);
|
||||
|
||||
await trrServer.stop();
|
||||
trrServer = null;
|
||||
|
|
|
|||
|
|
@ -206,6 +206,20 @@ add_task(async function testFallbackToTheOrigin() {
|
|||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "test.foo.com",
|
||||
ttl: 55,
|
||||
type: "HTTPS",
|
||||
flush: false,
|
||||
data: {
|
||||
priority: 3,
|
||||
name: "test.foo3.com",
|
||||
values: [
|
||||
{ key: "alpn", value: ["h2", "h3-26"] },
|
||||
{ key: "echconfig", value: "456..." },
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "test.foo.com",
|
||||
ttl: 55,
|
||||
|
|
@ -785,7 +799,6 @@ add_task(async function testHttp3ExcludedList() {
|
|||
name: "www.h3_fail.org",
|
||||
values: [
|
||||
{ key: "alpn", value: "h3-29" },
|
||||
{ key: "no-default-alpn" },
|
||||
{ key: "port", value: h3Port },
|
||||
],
|
||||
},
|
||||
|
|
@ -888,7 +901,6 @@ add_task(async function testAllRecordsInHttp3ExcludedList() {
|
|||
name: "www.h3_fail1.org",
|
||||
values: [
|
||||
{ key: "alpn", value: "h3-29" },
|
||||
{ key: "no-default-alpn" },
|
||||
{ key: "port", value: h3Port },
|
||||
{ key: "echconfig", value: "456..." },
|
||||
],
|
||||
|
|
|
|||
Loading…
Reference in a new issue