mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 18:07:34 +00:00
LibWeb: Add two more scheme helpers to the Fetch infrastructure
This commit is contained in:
parent
b02402e116
commit
66f4e2b3b0
2 changed files with 18 additions and 0 deletions
|
@ -1,5 +1,6 @@
|
|||
/*
|
||||
* Copyright (c) 2022, Linus Groh <linusg@serenityos.org>
|
||||
* Copyright (c) 2022, Andreas Kling <kling@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
@ -15,4 +16,18 @@ bool is_local_url(AK::URL const& url)
|
|||
return any_of(LOCAL_SCHEMES, [&](auto scheme) { return url.scheme() == scheme; });
|
||||
}
|
||||
|
||||
// https://fetch.spec.whatwg.org/#fetch-scheme
|
||||
bool is_fetch_scheme(StringView scheme)
|
||||
{
|
||||
// A fetch scheme is "about", "blob", "data", "file", or an HTTP(S) scheme.
|
||||
return any_of(FETCH_SCHEMES, [&](auto fetch_scheme) { return scheme == fetch_scheme; });
|
||||
}
|
||||
|
||||
// https://fetch.spec.whatwg.org/#http-scheme
|
||||
bool is_http_or_https_scheme(StringView scheme)
|
||||
{
|
||||
// An HTTP(S) scheme is "http" or "https".
|
||||
return any_of(HTTP_SCHEMES, [&](auto http_scheme) { return scheme == http_scheme; });
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue