URL.h 988 B

12345678910111213141516171819202122232425262728293031323334353637
  1. /*
  2. * Copyright (c) 2022, Linus Groh <linusg@serenityos.org>
  3. * Copyright (c) 2022, Andreas Kling <kling@serenityos.org>
  4. *
  5. * SPDX-License-Identifier: BSD-2-Clause
  6. */
  7. #pragma once
  8. #include <AK/Array.h>
  9. #include <AK/URL.h>
  10. namespace Web::Fetch::Infrastructure {
  11. // https://fetch.spec.whatwg.org/#local-scheme
  12. // A local scheme is "about", "blob", or "data".
  13. inline constexpr Array LOCAL_SCHEMES = {
  14. "about"sv, "blob"sv, "data"sv
  15. };
  16. // https://fetch.spec.whatwg.org/#http-scheme
  17. // An HTTP(S) scheme is "http" or "https".
  18. inline constexpr Array HTTP_SCHEMES = {
  19. "http"sv, "https"sv
  20. };
  21. // https://fetch.spec.whatwg.org/#fetch-scheme
  22. // A fetch scheme is "about", "blob", "data", "file", or an HTTP(S) scheme.
  23. inline constexpr Array FETCH_SCHEMES = {
  24. "about"sv, "blob"sv, "data"sv, "file"sv, "http"sv, "https"sv
  25. };
  26. [[nodiscard]] bool is_local_url(AK::URL const&);
  27. [[nodiscard]] bool is_fetch_scheme(StringView);
  28. [[nodiscard]] bool is_http_or_https_scheme(StringView);
  29. }