From: Jay Satiro Date: Mon, 3 Oct 2022 07:29:32 +0000 (-0400) Subject: connect: change verbose IPv6 address:port to [address]:port X-Git-Tag: curl-7_86_0~128 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=2b309560c1e5d6ed5c0e542e6fdffa968b0521c9;p=thirdparty%2Fcurl.git 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 --- diff --git a/lib/connect.c b/lib/connect.c index 13491c9817..c1d8cfd39e 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) &&