mirror of
https://github.com/curl/curl.git
synced 2026-08-03 05:30:32 +03:00
Gisle Vanem's improved verbose output and timeout handling when connecting to
a host name that resolves to multiple IP addresses.
This commit is contained in:
parent
2098871509
commit
9f341f9ce5
6 changed files with 116 additions and 92 deletions
22
lib/url.c
22
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];
|
||||
char addrbuf[256] = "";
|
||||
#ifdef ENABLE_IPV6
|
||||
const Curl_ipconnect *addr = conn->serv_addr;
|
||||
#else
|
||||
const Curl_ipconnect *addr = &conn->serv_addr.sin_addr;
|
||||
#endif
|
||||
|
||||
/* Get a printable version of the network address. */
|
||||
#ifdef ENABLE_IPV6
|
||||
struct addrinfo *ai = conn->serv_addr;
|
||||
host = Curl_printable_address(ai->ai_family, ai->ai_addr,
|
||||
addrbuf, sizeof(addrbuf));
|
||||
#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));
|
||||
#endif
|
||||
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);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue