diff options
author | Daniel Stenberg <daniel@haxx.se> | 2004-06-10 11:06:21 +0000 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2004-06-10 11:06:21 +0000 |
commit | 9f341f9ce5ff2cc85a4cbdd38cd4b5c68b02504d (patch) | |
tree | 6e6c97746450dee34253768bfbba72039fd04d4c /lib/url.c | |
parent | 20988715093810cde488cabe2b9f52fe5b300450 (diff) |
Gisle Vanem's improved verbose output and timeout handling when connecting to
a host name that resolves to multiple IP addresses.
Diffstat (limited to 'lib/url.c')
-rw-r--r-- | lib/url.c | 20 |
1 files changed, 8 insertions, 12 deletions
@@ -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); } /* |