mirror of
https://github.com/RGBCube/serenity
synced 2025-05-16 04:34:58 +00:00

The Fetch spec unfortunately will cause a name clash between the Request concept and the Request JS object - both cannot live in the Web::Fetch namespace, and WrapperGenerator generally assumes `Web::<Name>` for things living in the `<Name>/` subdirectory, so let's instead move infra code into its own namespace - it already sits in a (sub-)subdirectory anyway.
34 lines
824 B
C++
34 lines
824 B
C++
/*
|
|
* Copyright (c) 2022, Linus Groh <linusg@serenityos.org>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <AK/Array.h>
|
|
#include <AK/URL.h>
|
|
|
|
namespace Web::Fetch::Infrastructure {
|
|
|
|
// https://fetch.spec.whatwg.org/#local-scheme
|
|
// A local scheme is "about", "blob", or "data".
|
|
inline constexpr Array LOCAL_SCHEMES = {
|
|
"about"sv, "blob"sv, "data"sv
|
|
};
|
|
|
|
// https://fetch.spec.whatwg.org/#http-scheme
|
|
// An HTTP(S) scheme is "http" or "https".
|
|
inline constexpr Array HTTP_SCHEMES = {
|
|
"http"sv, "https"sv
|
|
};
|
|
|
|
// https://fetch.spec.whatwg.org/#fetch-scheme
|
|
// A fetch scheme is "about", "blob", "data", "file", or an HTTP(S) scheme.
|
|
inline constexpr Array FETCH_SCHEMES = {
|
|
"about"sv, "blob"sv, "data"sv, "file"sv, "http"sv, "https"sv
|
|
};
|
|
|
|
[[nodiscard]] bool is_local_url(AK::URL const&);
|
|
|
|
}
|