From 9f341f9ce5ff2cc85a4cbdd38cd4b5c68b02504d Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Thu, 10 Jun 2004 11:06:21 +0000 Subject: Gisle Vanem's improved verbose output and timeout handling when connecting to a host name that resolves to multiple IP addresses. --- lib/url.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) (limited to 'lib/url.c') diff --git a/lib/url.c b/lib/url.c index 2bc9e53c6..f83e49435 100644 --- a/lib/url.c +++ b/lib/url.c @@ -1990,22 +1990,18 @@ static CURLcode ConnectPlease(struct connectdata *conn, static void verboseconnect(struct connectdata *conn) { struct SessionHandle *data = conn->data; - const char *host=NULL; - char addrbuf[256]; - - /* Get a printable version of the network address. */ + char addrbuf[256] = ""; #ifdef ENABLE_IPV6 - struct addrinfo *ai = conn->serv_addr; - host = Curl_printable_address(ai->ai_family, ai->ai_addr, - addrbuf, sizeof(addrbuf)); + const Curl_ipconnect *addr = conn->serv_addr; #else - struct in_addr in; - (void) memcpy(&in.s_addr, &conn->serv_addr.sin_addr, sizeof (in.s_addr)); - host = Curl_inet_ntop(AF_INET, &in, addrbuf, sizeof(addrbuf)); + const Curl_ipconnect *addr = &conn->serv_addr.sin_addr; #endif + + /* Get a printable version of the network address. */ + Curl_printable_address(addr, addrbuf, sizeof(addrbuf)); infof(data, "Connected to %s (%s) port %d\n", - conn->bits.httpproxy?conn->proxy.dispname:conn->host.dispname, - host?host:"", conn->port); + conn->bits.httpproxy ? conn->proxy.dispname : conn->host.dispname, + addrbuf[0] ? addrbuf : "??", conn->port); } /* -- cgit v1.2.3