Added a dump_addrinfo() function to ease debugging of resolved names. Define
DEBUG_ADDRINFO to enable.
This commit is contained in:
parent
0c6bb8cb66
commit
021e786c71
@ -73,6 +73,7 @@
|
|||||||
#include "strerror.h"
|
#include "strerror.h"
|
||||||
#include "url.h"
|
#include "url.h"
|
||||||
#include "inet_pton.h"
|
#include "inet_pton.h"
|
||||||
|
#include "connect.h"
|
||||||
|
|
||||||
#define _MPRINTF_REPLACE /* use our functions only */
|
#define _MPRINTF_REPLACE /* use our functions only */
|
||||||
#include <curl/mprintf.h>
|
#include <curl/mprintf.h>
|
||||||
@ -186,6 +187,26 @@ bool Curl_ipvalid(struct SessionHandle *data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifndef USE_THREADING_GETADDRINFO
|
#ifndef USE_THREADING_GETADDRINFO
|
||||||
|
|
||||||
|
#ifdef DEBUG_ADDRINFO
|
||||||
|
static void dump_addrinfo(struct connectdata *conn, const struct addrinfo *ai)
|
||||||
|
{
|
||||||
|
printf("dump_addrinfo:\n");
|
||||||
|
for ( ; ai; ai = ai->ai_next) {
|
||||||
|
char buf[INET6_ADDRSTRLEN];
|
||||||
|
|
||||||
|
printf(" fam %2d, CNAME %s, ",
|
||||||
|
ai->ai_family, ai->ai_canonname ? ai->ai_canonname : "<none>");
|
||||||
|
if (Curl_printable_address(ai, buf, sizeof(buf)))
|
||||||
|
printf("%s\n", buf);
|
||||||
|
else
|
||||||
|
printf("failed; %s\n", Curl_strerror(conn, Curl_ourerrno()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
#define dump_addrinfo(x,y)
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Curl_getaddrinfo() when built ipv6-enabled (non-threading version).
|
* Curl_getaddrinfo() when built ipv6-enabled (non-threading version).
|
||||||
*
|
*
|
||||||
@ -266,6 +287,8 @@ Curl_addrinfo *Curl_getaddrinfo(struct connectdata *conn,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dump_addrinfo(conn, res);
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
#endif /* USE_THREADING_GETADDRINFO */
|
#endif /* USE_THREADING_GETADDRINFO */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user