diff --git a/Userland/Libraries/LibURL/Host.h b/Userland/Libraries/LibURL/Host.h new file mode 100644 index 00000000000..ee82c868e6b --- /dev/null +++ b/Userland/Libraries/LibURL/Host.h @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2024, Shannon Booth + * + * SPDX-License-Identifier: BSD-2-Clause + */ + +#pragma once + +#include +#include +#include + +namespace URL { + +// https://url.spec.whatwg.org/#concept-ipv4 +// An IPv4 address is a 32-bit unsigned integer that identifies a network address. [RFC791] +// FIXME: It would be nice if this were an AK::IPv4Address +using IPv4Address = u32; + +// https://url.spec.whatwg.org/#concept-ipv6 +// An IPv6 address is a 128-bit unsigned integer that identifies a network address. For the purposes of this standard +// it is represented as a list of eight 16-bit unsigned integers, also known as IPv6 pieces. [RFC4291] +// FIXME: It would be nice if this were an AK::IPv6Address +using IPv6Address = Array; + +// https://url.spec.whatwg.org/#concept-host +// A host is a domain, an IP address, an opaque host, or an empty host. Typically a host serves as a network address, +// but it is sometimes used as opaque identifier in URLs where a network address is not necessary. +using Host = Variant; + +} diff --git a/Userland/Libraries/LibURL/Origin.h b/Userland/Libraries/LibURL/Origin.h index f0f561ed9a8..0e310c98742 100644 --- a/Userland/Libraries/LibURL/Origin.h +++ b/Userland/Libraries/LibURL/Origin.h @@ -8,8 +8,8 @@ #pragma once #include +#include #include -#include namespace URL { diff --git a/Userland/Libraries/LibURL/URL.h b/Userland/Libraries/LibURL/URL.h index 63c7c59f2a2..6774ba678ee 100644 --- a/Userland/Libraries/LibURL/URL.h +++ b/Userland/Libraries/LibURL/URL.h @@ -13,6 +13,7 @@ #include #include #include +#include // On Linux distros that use mlibc `basename` is defined as a macro that expands to `__mlibc_gnu_basename` or `__mlibc_gnu_basename_c`, so we undefine it. #if defined(AK_OS_LINUX) && defined(basename) @@ -38,22 +39,6 @@ enum class ExcludeFragment { Yes }; -// https://url.spec.whatwg.org/#concept-ipv4 -// An IPv4 address is a 32-bit unsigned integer that identifies a network address. [RFC791] -// FIXME: It would be nice if this were an AK::IPv4Address -using IPv4Address = u32; - -// https://url.spec.whatwg.org/#concept-ipv6 -// An IPv6 address is a 128-bit unsigned integer that identifies a network address. For the purposes of this standard -// it is represented as a list of eight 16-bit unsigned integers, also known as IPv6 pieces. [RFC4291] -// FIXME: It would be nice if this were an AK::IPv6Address -using IPv6Address = Array; - -// https://url.spec.whatwg.org/#concept-host -// A host is a domain, an IP address, an opaque host, or an empty host. Typically a host serves as a network address, -// but it is sometimes used as opaque identifier in URLs where a network address is not necessary. -using Host = Variant; - // https://w3c.github.io/FileAPI/#blob-url-entry // NOTE: This represents the raw bytes behind a 'Blob' (and does not yet support a MediaSourceQuery). struct BlobURLEntry {