mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-13 13:02:28 +00:00
LibURL: Factor Host into a standalone header file
This will help solve a future circular dependency between URL.h and Origin.h
This commit is contained in:
parent
dc401f49ea
commit
53ad982bb7
Notes:
github-actions[bot]
2024-10-05 08:47:49 +00:00
Author: https://github.com/shannonbooth
Commit: 53ad982bb7
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1636
3 changed files with 33 additions and 17 deletions
31
Userland/Libraries/LibURL/Host.h
Normal file
31
Userland/Libraries/LibURL/Host.h
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2024, Shannon Booth <shannon@serenityos.org>
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <AK/Array.h>
|
||||||
|
#include <AK/String.h>
|
||||||
|
#include <AK/Types.h>
|
||||||
|
|
||||||
|
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<u16, 8>;
|
||||||
|
|
||||||
|
// 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<IPv4Address, IPv6Address, String, Empty>;
|
||||||
|
|
||||||
|
}
|
|
@ -8,8 +8,8 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <AK/ByteString.h>
|
#include <AK/ByteString.h>
|
||||||
|
#include <LibURL/Host.h>
|
||||||
#include <LibURL/Parser.h>
|
#include <LibURL/Parser.h>
|
||||||
#include <LibURL/URL.h>
|
|
||||||
|
|
||||||
namespace URL {
|
namespace URL {
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
#include <AK/String.h>
|
#include <AK/String.h>
|
||||||
#include <AK/StringView.h>
|
#include <AK/StringView.h>
|
||||||
#include <AK/Vector.h>
|
#include <AK/Vector.h>
|
||||||
|
#include <LibURL/Host.h>
|
||||||
|
|
||||||
// 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.
|
// 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)
|
#if defined(AK_OS_LINUX) && defined(basename)
|
||||||
|
@ -38,22 +39,6 @@ enum class ExcludeFragment {
|
||||||
Yes
|
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<u16, 8>;
|
|
||||||
|
|
||||||
// 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<IPv4Address, IPv6Address, String, Empty>;
|
|
||||||
|
|
||||||
// https://w3c.github.io/FileAPI/#blob-url-entry
|
// https://w3c.github.io/FileAPI/#blob-url-entry
|
||||||
// NOTE: This represents the raw bytes behind a 'Blob' (and does not yet support a MediaSourceQuery).
|
// NOTE: This represents the raw bytes behind a 'Blob' (and does not yet support a MediaSourceQuery).
|
||||||
struct BlobURLEntry {
|
struct BlobURLEntry {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue