1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 23:17:45 +00:00

LookupServer: Store DNSName's in HashMap's directly

DNSName can now take care of case conversion when comparing using traits.
It still intentionally doesn't implement operator ==; you have to explicitly
decide whether you want case-sensitive or case-insensitive comparison.

This change makes caches (and /etc/hosts) case-transparent: we will now match
domains if they're the same except for the case.
This commit is contained in:
Sergey Bugaev 2021-02-14 16:33:16 +03:00 committed by Andreas Kling
parent bacbde31f3
commit e9387e43db
4 changed files with 23 additions and 7 deletions

View file

@ -105,4 +105,14 @@ OutputStream& operator<<(OutputStream& stream, const DNSName& name)
return stream;
}
unsigned DNSName::Traits::hash(const DNSName& name)
{
return CaseInsensitiveStringTraits::hash(name.as_string());
}
bool DNSName::Traits::equals(const DNSName& a, const DNSName& b)
{
return CaseInsensitiveStringTraits::equals(a.as_string(), b.as_string());
}
}