diff --git a/Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP.cpp b/Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP.cpp index 253c74a3b9..38996a453f 100644 --- a/Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP.cpp +++ b/Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP.cpp @@ -9,7 +9,7 @@ #include #include -namespace Web::Fetch { +namespace Web::Fetch::Infrastructure { // https://fetch.spec.whatwg.org/#collect-an-http-quoted-string String collect_an_http_quoted_string(GenericLexer& lexer, HttpQuotedStringExtractValue extract_value) diff --git a/Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP.h b/Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP.h index ded5f21e69..e3abd60062 100644 --- a/Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP.h +++ b/Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP.h @@ -10,7 +10,7 @@ #include #include -namespace Web::Fetch { +namespace Web::Fetch::Infrastructure { // https://fetch.spec.whatwg.org/#http-tab-or-space // An HTTP tab or space is U+0009 TAB or U+0020 SPACE. diff --git a/Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Bodies.cpp b/Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Bodies.cpp index 2c9932ab7f..98c7cb91cd 100644 --- a/Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Bodies.cpp +++ b/Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Bodies.cpp @@ -6,7 +6,7 @@ #include -namespace Web::Fetch { +namespace Web::Fetch::Infrastructure { Body::Body(ReadableStreamDummy stream) : m_stream(stream) diff --git a/Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Bodies.h b/Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Bodies.h index 4665ba09e4..424023b6c1 100644 --- a/Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Bodies.h +++ b/Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Bodies.h @@ -13,7 +13,7 @@ #include #include -namespace Web::Fetch { +namespace Web::Fetch::Infrastructure { // https://fetch.spec.whatwg.org/#concept-body class Body final { diff --git a/Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Headers.cpp b/Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Headers.cpp index f28018e17e..d2b3fb4549 100644 --- a/Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Headers.cpp +++ b/Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Headers.cpp @@ -16,7 +16,7 @@ #include #include -namespace Web::Fetch { +namespace Web::Fetch::Infrastructure { template requires(IsSameIgnoringCV) struct CaseInsensitiveBytesTraits : public Traits> { diff --git a/Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Headers.h b/Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Headers.h index 6973e04c0e..3040c5706b 100644 --- a/Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Headers.h +++ b/Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Headers.h @@ -14,7 +14,7 @@ #include #include -namespace Web::Fetch { +namespace Web::Fetch::Infrastructure { // https://fetch.spec.whatwg.org/#concept-header // A header is a tuple that consists of a name (a header name) and value (a header value). diff --git a/Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Methods.cpp b/Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Methods.cpp index 4f62e896f1..ec877a73a8 100644 --- a/Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Methods.cpp +++ b/Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Methods.cpp @@ -11,7 +11,7 @@ #include #include -namespace Web::Fetch { +namespace Web::Fetch::Infrastructure { // https://fetch.spec.whatwg.org/#concept-method bool is_method(ReadonlyBytes method) diff --git a/Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Methods.h b/Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Methods.h index 4b77d3d5f7..1258616a60 100644 --- a/Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Methods.h +++ b/Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Methods.h @@ -8,7 +8,7 @@ #include -namespace Web::Fetch { +namespace Web::Fetch::Infrastructure { [[nodiscard]] bool is_method(ReadonlyBytes); [[nodiscard]] bool is_cors_safelisted_method(ReadonlyBytes); diff --git a/Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Requests.cpp b/Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Requests.cpp index bd53ad510e..bffcf88a2e 100644 --- a/Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Requests.cpp +++ b/Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Requests.cpp @@ -7,7 +7,7 @@ #include #include -namespace Web::Fetch { +namespace Web::Fetch::Infrastructure { // https://fetch.spec.whatwg.org/#concept-request-url AK::URL const& Request::url() const diff --git a/Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Requests.h b/Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Requests.h index 16f1b5873e..bdd10a63dc 100644 --- a/Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Requests.h +++ b/Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Requests.h @@ -20,7 +20,7 @@ #include #include -namespace Web::Fetch { +namespace Web::Fetch::Infrastructure { // https://fetch.spec.whatwg.org/#concept-request class Request final { diff --git a/Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Responses.cpp b/Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Responses.cpp index 2eb6ec4152..33d614023e 100644 --- a/Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Responses.cpp +++ b/Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Responses.cpp @@ -6,7 +6,7 @@ #include -namespace Web::Fetch { +namespace Web::Fetch::Infrastructure { // https://fetch.spec.whatwg.org/#ref-for-concept-network-error%E2%91%A3 // A network error is a response whose status is always 0, status message is always diff --git a/Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Responses.h b/Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Responses.h index 58b21e4891..2ab0fafbcd 100644 --- a/Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Responses.h +++ b/Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Responses.h @@ -16,7 +16,7 @@ #include #include -namespace Web::Fetch { +namespace Web::Fetch::Infrastructure { // https://fetch.spec.whatwg.org/#concept-response class Response { diff --git a/Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Statuses.cpp b/Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Statuses.cpp index 5bf1d0a702..09ed783a56 100644 --- a/Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Statuses.cpp +++ b/Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Statuses.cpp @@ -8,7 +8,7 @@ #include #include -namespace Web::Fetch { +namespace Web::Fetch::Infrastructure { // https://fetch.spec.whatwg.org/#null-body-status bool is_null_body_status(Status status) diff --git a/Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Statuses.h b/Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Statuses.h index 7815f2e144..22ea181628 100644 --- a/Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Statuses.h +++ b/Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Statuses.h @@ -8,7 +8,7 @@ #include -namespace Web::Fetch { +namespace Web::Fetch::Infrastructure { // https://fetch.spec.whatwg.org/#concept-status // A status is an integer in the range 0 to 999, inclusive. diff --git a/Userland/Libraries/LibWeb/Fetch/Infrastructure/URL.cpp b/Userland/Libraries/LibWeb/Fetch/Infrastructure/URL.cpp index 34ab04bef9..9ed3612763 100644 --- a/Userland/Libraries/LibWeb/Fetch/Infrastructure/URL.cpp +++ b/Userland/Libraries/LibWeb/Fetch/Infrastructure/URL.cpp @@ -6,7 +6,7 @@ #include -namespace Web::Fetch { +namespace Web::Fetch::Infrastructure { // https://fetch.spec.whatwg.org/#is-local bool is_local_url(AK::URL const& url) diff --git a/Userland/Libraries/LibWeb/Fetch/Infrastructure/URL.h b/Userland/Libraries/LibWeb/Fetch/Infrastructure/URL.h index d235577398..17d2497148 100644 --- a/Userland/Libraries/LibWeb/Fetch/Infrastructure/URL.h +++ b/Userland/Libraries/LibWeb/Fetch/Infrastructure/URL.h @@ -9,7 +9,7 @@ #include #include -namespace Web::Fetch { +namespace Web::Fetch::Infrastructure { // https://fetch.spec.whatwg.org/#local-scheme // A local scheme is "about", "blob", or "data". diff --git a/Userland/Libraries/LibWeb/Forward.h b/Userland/Libraries/LibWeb/Forward.h index efd9620f68..219a57d8ac 100644 --- a/Userland/Libraries/LibWeb/Forward.h +++ b/Userland/Libraries/LibWeb/Forward.h @@ -170,7 +170,7 @@ namespace Web::Encoding { class TextEncoder; } -namespace Web::Fetch { +namespace Web::Fetch::Infrastructure { class Body; struct Header; class HeaderList; diff --git a/Userland/Libraries/LibWeb/MimeSniff/MimeType.cpp b/Userland/Libraries/LibWeb/MimeSniff/MimeType.cpp index 7d3d7fcf64..83c74b3454 100644 --- a/Userland/Libraries/LibWeb/MimeSniff/MimeType.cpp +++ b/Userland/Libraries/LibWeb/MimeSniff/MimeType.cpp @@ -54,7 +54,7 @@ static bool contains_only_http_token_code_points(StringView string) Optional MimeType::from_string(StringView string) { // 1. Remove any leading and trailing HTTP whitespace from input. - auto trimmed_string = string.trim(Fetch::HTTP_WHITESPACE, TrimMode::Both); + auto trimmed_string = string.trim(Fetch::Infrastructure::HTTP_WHITESPACE, TrimMode::Both); // 2. Let position be a position variable for input, initially pointing at the start of input. GenericLexer lexer(trimmed_string); @@ -77,7 +77,7 @@ Optional MimeType::from_string(StringView string) auto subtype = lexer.consume_until(';'); // 8. Remove any trailing HTTP whitespace from subtype. - subtype = subtype.trim(Fetch::HTTP_WHITESPACE, TrimMode::Right); + subtype = subtype.trim(Fetch::Infrastructure::HTTP_WHITESPACE, TrimMode::Right); // 9. If subtype is the empty string or does not solely contain HTTP token code points, then return failure. if (subtype.is_empty() || !contains_only_http_token_code_points(subtype)) @@ -92,7 +92,7 @@ Optional MimeType::from_string(StringView string) lexer.ignore(1); // 2. Collect a sequence of code points that are HTTP whitespace from input given position. - lexer.ignore_while(is_any_of(Fetch::HTTP_WHITESPACE)); + lexer.ignore_while(is_any_of(Fetch::Infrastructure::HTTP_WHITESPACE)); // 3. Let parameterName be the result of collecting a sequence of code points that are not U+003B (;) or U+003D (=) from input, given position. auto parameter_name = lexer.consume_until([](char ch) { @@ -124,7 +124,7 @@ Optional MimeType::from_string(StringView string) // 8. If the code point at position within input is U+0022 ("), then: if (lexer.peek() == '"') { // 1. Set parameterValue to the result of collecting an HTTP quoted string from input, given position and the extract-value flag. - parameter_value = Fetch::collect_an_http_quoted_string(lexer, Fetch::HttpQuotedStringExtractValue::Yes); + parameter_value = Fetch::Infrastructure::collect_an_http_quoted_string(lexer, Fetch::Infrastructure::HttpQuotedStringExtractValue::Yes); // 2. Collect a sequence of code points that are not U+003B (;) from input, given position. // NOTE: This uses the predicate version as the ignore_until(char) version will also ignore the ';'. @@ -139,7 +139,7 @@ Optional MimeType::from_string(StringView string) parameter_value = lexer.consume_until(';'); // 2. Remove any trailing HTTP whitespace from parameterValue. - parameter_value = parameter_value.trim(Fetch::HTTP_WHITESPACE, TrimMode::Right); + parameter_value = parameter_value.trim(Fetch::Infrastructure::HTTP_WHITESPACE, TrimMode::Right); // 3. If parameterValue is the empty string, then continue. if (parameter_value.is_empty()) diff --git a/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.cpp b/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.cpp index 8e972779bb..69d86de233 100644 --- a/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.cpp +++ b/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.cpp @@ -203,9 +203,9 @@ MimeSniff::MimeType XMLHttpRequest::get_response_mime_type() const { // 1. Let mimeType be the result of extracting a MIME type from xhr’s response’s header list. // FIXME: Use an actual HeaderList for XHR headers. - Fetch::HeaderList header_list; + Fetch::Infrastructure::HeaderList header_list; for (auto const& entry : m_response_headers) { - auto header = Fetch::Header { + auto header = Fetch::Infrastructure::Header { .name = MUST(ByteBuffer::copy(entry.key.bytes())), .value = MUST(ByteBuffer::copy(entry.value.bytes())), }; @@ -257,7 +257,7 @@ Optional XMLHttpRequest::get_final_encoding() const // https://fetch.spec.whatwg.org/#concept-header-extract-mime-type // FIXME: This is not only used by XHR, it is also used for multiple things in Fetch. -Optional XMLHttpRequest::extract_mime_type(Fetch::HeaderList const& header_list) const +Optional XMLHttpRequest::extract_mime_type(Fetch::Infrastructure::HeaderList const& header_list) const { // 1. Let charset be null. Optional charset; @@ -313,13 +313,13 @@ Optional XMLHttpRequest::extract_mime_type(Fetch::HeaderLis // https://fetch.spec.whatwg.org/#concept-bodyinit-extract // FIXME: The parameter 'body_init' should be 'typedef (ReadableStream or XMLHttpRequestBodyInit) BodyInit'. For now we just let it be 'XMLHttpRequestBodyInit'. -static Fetch::BodyWithType extract_body(XMLHttpRequestBodyInit const& body_init) +static Fetch::Infrastructure::BodyWithType extract_body(XMLHttpRequestBodyInit const& body_init) { // FIXME: 1. Let stream be object if object is a ReadableStream object. Otherwise, let stream be a new ReadableStream, and set up stream. - Fetch::Body::ReadableStreamDummy stream {}; + Fetch::Infrastructure::Body::ReadableStreamDummy stream {}; // FIXME: 2. Let action be null. // 3. Let source be null. - Fetch::Body::SourceType source {}; + Fetch::Infrastructure::Body::SourceType source {}; // 4. Let length be null. Optional length {}; // 5. Let type be null. @@ -356,7 +356,7 @@ static Fetch::BodyWithType extract_body(XMLHttpRequestBodyInit const& body_init) // FIXME: 8. If action is non-null, then run these steps in in parallel: // 9. Let body be a body whose stream is stream, source is source, and length is length. - auto body = Fetch::Body { move(stream), move(source), move(length) }; + auto body = Fetch::Infrastructure::Body { move(stream), move(source), move(length) }; // 10. Return (body, type). return { .body = move(body), .type = move(type) }; } @@ -376,16 +376,16 @@ DOM::ExceptionOr XMLHttpRequest::set_request_header(String const& name_str return DOM::InvalidStateError::create("XHR send() flag is already set"); // 3. Normalize value. - value = MUST(Fetch::normalize_header_value(value)); + value = MUST(Fetch::Infrastructure::normalize_header_value(value)); // 4. If name is not a header name or value is not a header value, then throw a "SyntaxError" DOMException. - if (!Fetch::is_header_name(name)) + if (!Fetch::Infrastructure::is_header_name(name)) return DOM::SyntaxError::create("Header name contains invalid characters."); - if (!Fetch::is_header_value(value)) + if (!Fetch::Infrastructure::is_header_value(value)) return DOM::SyntaxError::create("Header value contains invalid characters."); // 5. If name is a forbidden header name, then return. - if (Fetch::is_forbidden_header_name(name)) + if (Fetch::Infrastructure::is_forbidden_header_name(name)) return {}; // 6. Combine (name, value) in this’s author request headers. @@ -423,15 +423,15 @@ DOM::ExceptionOr XMLHttpRequest::open(String const& method_string, String return DOM::InvalidStateError::create("Invalid state: Responsible document is not fully active."); // 3. If method is not a method, then throw a "SyntaxError" DOMException. - if (!Fetch::is_method(method)) + if (!Fetch::Infrastructure::is_method(method)) return DOM::SyntaxError::create("An invalid or illegal string was specified."); // 4. If method is a forbidden method, then throw a "SecurityError" DOMException. - if (Fetch::is_forbidden_method(method)) + if (Fetch::Infrastructure::is_forbidden_method(method)) return DOM::SecurityError::create("Forbidden method, must not be 'CONNECT', 'TRACE', or 'TRACK'"); // 5. Normalize method. - method = MUST(Fetch::normalize_method(method)); + method = MUST(Fetch::Infrastructure::normalize_method(method)); // 6. Let parsedURL be the result of parsing url with settingsObject’s API base URL and settingsObject’s API URL character encoding. auto parsed_url = settings_object.api_base_url().complete_url(url); @@ -500,7 +500,7 @@ DOM::ExceptionOr XMLHttpRequest::send(Optional bod if (m_method.is_one_of("GET"sv, "HEAD"sv)) body = {}; - auto body_with_type = body.has_value() ? extract_body(body.value()) : Optional {}; + auto body_with_type = body.has_value() ? extract_body(body.value()) : Optional {}; AK::URL request_url = m_window->associated_document().parse_url(m_url.to_string()); dbgln("XHR send from {} to {}", m_window->associated_document().url(), request_url); diff --git a/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.h b/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.h index 1429860661..365ce296dd 100644 --- a/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.h +++ b/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.h @@ -55,7 +55,7 @@ public: using RefCounted::unref; ReadyState ready_state() const { return m_ready_state; }; - Fetch::Status status() const { return m_status; }; + Fetch::Infrastructure::Status status() const { return m_status; }; DOM::ExceptionOr response_text() const; DOM::ExceptionOr response(); Bindings::XMLHttpRequestResponseType response_type() const { return m_response_type; } @@ -84,7 +84,7 @@ private: virtual JS::Object* create_wrapper(JS::GlobalObject&) override; void set_ready_state(ReadyState); - void set_status(Fetch::Status status) { m_status = status; } + void set_status(Fetch::Infrastructure::Status status) { m_status = status; } void fire_progress_event(String const&, u64, u64); MimeSniff::MimeType get_response_mime_type() const; @@ -93,14 +93,14 @@ private: String get_text_response() const; - Optional extract_mime_type(Fetch::HeaderList const& header_list) const; + Optional extract_mime_type(Fetch::Infrastructure::HeaderList const& header_list) const; explicit XMLHttpRequest(HTML::Window&); NonnullRefPtr m_window; ReadyState m_ready_state { ReadyState::Unsent }; - Fetch::Status m_status { 0 }; + Fetch::Infrastructure::Status m_status { 0 }; bool m_send { false }; u32 m_timeout { 0 };