mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-31 21:29:06 +00:00
LibURL: Correctly acquire the registrable domain for a URL
We were using the public suffix of the URL's host as its registrable domain. But the registrable domain is actually the public suffix plus one additional label.
This commit is contained in:
parent
d0f80e1f05
commit
a34f7a5bd1
Notes:
github-actions[bot]
2025-03-11 11:11:58 +00:00
Author: https://github.com/trflynn89
Commit: a34f7a5bd1
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3882
Reviewed-by: https://github.com/gmta ✅
4 changed files with 75 additions and 1 deletions
|
@ -220,7 +220,7 @@ Optional<String> Host::registrable_domain() const
|
|||
// 3. Let registrableDomain be the registrable domain determined by running the Public Suffix List algorithm with host as domain. [PSL]
|
||||
// NOTE: The spec algorithm for the public suffix returns "*" by default, but get_public_suffix() returns an empty Optional.
|
||||
// Remove the `value_or()` if and when we update it.
|
||||
auto registrable_domain = get_public_suffix(host_string).value_or("*"_string);
|
||||
auto registrable_domain = get_registrable_domain(host_string).value_or("*"_string);
|
||||
|
||||
// 4. Assert: registrableDomain is an ASCII string that does not end with ".".
|
||||
VERIFY(all_of(registrable_domain.code_points(), is_ascii));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue