mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-29 12:19:54 +00:00
LibURL: Add helper for getting array of the special schemes
This is useful for iterating over all of the special schemes, as needed in the URLPattern implementation.
This commit is contained in:
parent
e3ef6d3aee
commit
45d852d14b
Notes:
github-actions[bot]
2025-04-06 12:27:44 +00:00
Author: https://github.com/shannonbooth
Commit: 45d852d14b
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3847
Reviewed-by: https://github.com/trflynn89
2 changed files with 16 additions and 1 deletions
|
@ -207,9 +207,23 @@ URL create_with_data(StringView mime_type, StringView payload, bool is_base64)
|
|||
}
|
||||
|
||||
// https://url.spec.whatwg.org/#special-scheme
|
||||
ReadonlySpan<StringView> special_schemes()
|
||||
{
|
||||
static auto const schemes = to_array<StringView>({
|
||||
"ftp"sv,
|
||||
"file"sv,
|
||||
"http"sv,
|
||||
"https"sv,
|
||||
"ws"sv,
|
||||
"wss"sv,
|
||||
});
|
||||
return schemes;
|
||||
}
|
||||
|
||||
// https://url.spec.whatwg.org/#is-special
|
||||
bool is_special_scheme(StringView scheme)
|
||||
{
|
||||
return scheme.is_one_of("ftp", "file", "http", "https", "ws", "wss");
|
||||
return special_schemes().contains_slow(scheme);
|
||||
}
|
||||
|
||||
// https://url.spec.whatwg.org/#url-path-serializer
|
||||
|
|
|
@ -61,6 +61,7 @@ void append_percent_encoded_if_necessary(StringBuilder&, u32 code_point, Percent
|
|||
void append_percent_encoded(StringBuilder&, u32 code_point);
|
||||
bool code_point_is_in_percent_encode_set(u32 code_point, PercentEncodeSet);
|
||||
Optional<u16> default_port_for_scheme(StringView);
|
||||
ReadonlySpan<StringView> special_schemes();
|
||||
bool is_special_scheme(StringView);
|
||||
|
||||
enum class SpaceAsPlus {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue