Ever since PublicSuffixData was created, it was using "no star rule" matching, which is what is needed for the address bar to distinguish between a domain and a search. URL::Host on the other hand requires the fallback star rule. Which rule is needed depends on the use case of the PSL. Support both use cases by a flag in PublicSuffixData.
30 lines
857 B
C++
30 lines
857 B
C++
/*
|
|
* Copyright (c) 2026-present, the Ladybird developers.
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <AK/Forward.h>
|
|
#include <AK/Optional.h>
|
|
#include <LibURL/Forward.h>
|
|
|
|
namespace URL {
|
|
|
|
class PublicSuffixData {
|
|
public:
|
|
enum class IncludeStarRule {
|
|
No,
|
|
Yes,
|
|
};
|
|
|
|
static bool is_matching_public_suffix(StringView host, IncludeStarRule);
|
|
static bool is_matching_public_suffix(Host const& host, IncludeStarRule);
|
|
static Optional<String> find_matching_public_suffix(StringView string, IncludeStarRule);
|
|
static Optional<String> find_matching_public_suffix(Host const& host, IncludeStarRule);
|
|
static Optional<String> find_matching_registrable_domain(StringView string, IncludeStarRule);
|
|
static Optional<String> find_matching_registrable_domain(Host const& host, IncludeStarRule);
|
|
};
|
|
|
|
}
|