diff --git a/Userland/Libraries/LibWeb/Fetch/Fetching/Fetching.cpp b/Userland/Libraries/LibWeb/Fetch/Fetching/Fetching.cpp index 5f47cad3879..b846ca21b47 100644 --- a/Userland/Libraries/LibWeb/Fetch/Fetching/Fetching.cpp +++ b/Userland/Libraries/LibWeb/Fetch/Fetching/Fetching.cpp @@ -256,7 +256,7 @@ WebIDL::ExceptionOr>> main_fetch(JS:: // - request’s current URL’s scheme is "http" request->current_url().scheme() == "http"sv // - request’s current URL’s host is a domain - && URL::host_is_domain(request->current_url().serialized_host().release_value_but_fixme_should_propagate_errors()) + && URL::host_is_domain(request->current_url().host()) // FIXME: - Matching request’s current URL’s host per Known HSTS Host Domain Name Matching results in either a // superdomain match with an asserted includeSubDomains directive or a congruent match (with or without an // asserted includeSubDomains directive) [HSTS]; or DNS resolution for the request finds a matching HTTPS RR diff --git a/Userland/Libraries/LibWeb/URL/URL.cpp b/Userland/Libraries/LibWeb/URL/URL.cpp index a9ec5f547ab..74577e7879c 100644 --- a/Userland/Libraries/LibWeb/URL/URL.cpp +++ b/Userland/Libraries/LibWeb/URL/URL.cpp @@ -482,12 +482,10 @@ HTML::Origin url_origin(AK::URL const& url) } // https://url.spec.whatwg.org/#concept-domain -bool host_is_domain(StringView host) +bool host_is_domain(AK::URL::Host const& host) { // A domain is a non-empty ASCII string that identifies a realm within a network. - return !host.is_empty() - && !IPv4Address::from_string(host).has_value() - && !IPv6Address::from_string(host).has_value(); + return host.has() && host.get() != String {}; } // https://url.spec.whatwg.org/#concept-url-parser diff --git a/Userland/Libraries/LibWeb/URL/URL.h b/Userland/Libraries/LibWeb/URL/URL.h index 8b4c7c79a00..32cdf993433 100644 --- a/Userland/Libraries/LibWeb/URL/URL.h +++ b/Userland/Libraries/LibWeb/URL/URL.h @@ -75,7 +75,7 @@ private: }; HTML::Origin url_origin(AK::URL const&); -bool host_is_domain(StringView host); +bool host_is_domain(AK::URL::Host const&); // https://url.spec.whatwg.org/#concept-url-parser AK::URL parse(StringView input, Optional const& base_url = {});