aboutsummaryrefslogtreecommitdiff
path: root/lib/url.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2004-06-10 11:06:21 +0000
committerDaniel Stenberg <daniel@haxx.se>2004-06-10 11:06:21 +0000
commit9f341f9ce5ff2cc85a4cbdd38cd4b5c68b02504d (patch)
tree6e6c97746450dee34253768bfbba72039fd04d4c /lib/url.c
parent20988715093810cde488cabe2b9f52fe5b300450 (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.c20
1 files changed, 8 insertions, 12 deletions
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);
}
/*