LibURL: Replace Host's Empty state with making Url's Host optional

A couple of reasons:
- Origin's Host (when in the tuple state) can't be null
- There's an "empty host" concept in the spec which is NOT the same as a
  null Host, and that was confusing me.
This commit is contained in:
Sam Atkins 2024-11-27 12:48:28 +00:00 committed by Andreas Kling
commit 90e763de4c
Notes: github-actions[bot] 2024-11-30 11:24:09 +00:00
17 changed files with 44 additions and 42 deletions

View file

@ -36,9 +36,9 @@ struct ProxyData {
proxy_data.type = ProxyData::Type::SOCKS5;
if (!url.host().has<URL::IPv4Address>())
if (!url.host().has_value() || !url.host()->has<URL::IPv4Address>())
return Error::from_string_literal("Invalid proxy host, must be an IPv4 address");
proxy_data.host_ipv4 = url.host().get<URL::IPv4Address>();
proxy_data.host_ipv4 = url.host()->get<URL::IPv4Address>();
auto port = url.port();
if (!port.has_value())