From 2b309560c1e5d6ed5c0e542e6fdffa968b0521c9 Mon Sep 17 00:00:00 2001 From: Jay Satiro Date: Mon, 3 Oct 2022 03:29:32 -0400 Subject: [PATCH] connect: change verbose IPv6 address:port to [address]:port - Use brackets for the IPv6 address shown in verbose message when the format is address:port so that it is less confusing. Before: Trying 2606:4700:4700::1111:443... After: Trying [2606:4700:4700::1111]:443... Bug: https://curl.se/mail/archive-2022-02/0041.html Reported-by: David Hu Closes #9635 --- lib/connect.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/connect.c b/lib/connect.c index 13491c981..c1d8cfd39 100644 --- a/lib/connect.c +++ b/lib/connect.c @@ -1222,7 +1222,11 @@ static CURLcode singleipconnect(struct Curl_easy *data, Curl_closesocket(data, conn, sockfd); return CURLE_OK; } - infof(data, " Trying %s:%d...", ipaddress, port); + infof(data, " Trying %s%s%s:%d...", + (addr.family == AF_INET6 ? "[" : ""), + ipaddress, + (addr.family == AF_INET6 ? "]" : ""), + port); #ifdef ENABLE_IPV6 is_tcp = (addr.family == AF_INET || addr.family == AF_INET6) &&