LibCore: Don't discard subsequent results in Socket::resolve_host

Previously, we only returned the first result that looked like an IPv6
or IPv4 address.

This cropped up when attempting to connect to https://cxbyte.me/ whilst
IPv6 on the server wasn't working. Since we only returned the first
result, which happened to be the IPv6 address, we wasn't able to
connect.

Returning all results allows curl to attempt to connect to a different
IP if one of them isn't working, and potentially make a successful
connection.
This commit is contained in:
Luke Wilde 2025-02-28 12:50:03 +00:00 committed by Ali Mohammad Pur
commit 08246bfa8c
Notes: github-actions[bot] 2025-02-28 14:15:30 +00:00
3 changed files with 33 additions and 18 deletions

View file

@ -58,7 +58,7 @@ public:
// FIXME: This will need to be updated when IPv6 socket arrives. Perhaps a
// base class for all address types is appropriate.
static ErrorOr<Variant<IPv4Address, IPv6Address>> resolve_host(ByteString const&, SocketType);
static ErrorOr<Vector<Variant<IPv4Address, IPv6Address>>> resolve_host(ByteString const&, SocketType);
Function<void()> on_ready_to_read;