Bug 1652655 - P1: Sort HTTPSSVC records, r=dragana,necko-reviewers

Differential Revision: https://phabricator.services.mozilla.com/D85121
This commit is contained in:
Kershaw Chang 2020-08-21 18:59:03 +00:00
Родитель c1e5ec87eb
Коммит 2e10bf25d7
2 изменённых файлов: 13 добавлений и 0 удалений

Просмотреть файл

@ -82,6 +82,9 @@ struct SVCB {
mSvcDomainName == aOther.mSvcDomainName &&
mSvcFieldValue == aOther.mSvcFieldValue;
}
bool operator<(const SVCB& aOther) const {
return mSvcFieldPriority < aOther.mSvcFieldPriority;
}
uint16_t mSvcFieldPriority = 0;
nsCString mSvcDomainName;
CopyableTArray<SvcFieldValue> mSvcFieldValue;

Просмотреть файл

@ -1197,6 +1197,16 @@ nsresult TRR::DohDecode(nsCString& aHost) {
LOG(("TRR: No entries were stored!\n"));
return NS_ERROR_FAILURE;
}
// https://tools.ietf.org/html/draft-ietf-dnsop-svcb-httpssvc-03#page-14
// If one or more SVCB records of ServiceForm SvcRecordType are returned for
// HOST, clients should select the highest-priority option with acceptable
// parameters.
if (mResult.is<TypeRecordHTTPSSVC>()) {
auto& results = mResult.as<TypeRecordHTTPSSVC>();
results.Sort();
}
return NS_OK;
}