Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
127 changes: 61 additions & 66 deletions lib/hostip.c
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,67 @@

#ifndef CURL_DISABLE_VERBOSE_STRINGS
static void show_resolve_info(struct Curl_easy *data,
struct Curl_dns_entry *dns);
struct Curl_dns_entry *dns)
{
struct Curl_addrinfo *a;
CURLcode result = CURLE_OK;
#ifdef CURLRES_IPV6
struct dynbuf out[2];
#else
struct dynbuf out[1];
#endif
DEBUGASSERT(data);
DEBUGASSERT(dns);

if(!data->set.verbose ||
/* ignore no name or numerical IP addresses */
!dns->hostname[0] || Curl_host_is_ipnum(dns->hostname))
return;

a = dns->addr;

infof(data, "Host %s:%d was resolved.",
(dns->hostname[0] ? dns->hostname : "(none)"), dns->hostport);

curlx_dyn_init(&out[0], 1024);
#ifdef CURLRES_IPV6
curlx_dyn_init(&out[1], 1024);
#endif

while(a) {
if(
#ifdef CURLRES_IPV6
a->ai_family == PF_INET6 ||
#endif
a->ai_family == PF_INET) {
char buf[MAX_IPADR_LEN];
struct dynbuf *d = &out[(a->ai_family != PF_INET)];
Curl_printable_address(a, buf, sizeof(buf));
if(curlx_dyn_len(d))
result = curlx_dyn_addn(d, ", ", 2);
if(!result)
result = curlx_dyn_add(d, buf);
if(result) {
infof(data, "too many IP, cannot show");
goto fail;
}
}
a = a->ai_next;
}

#ifdef CURLRES_IPV6
infof(data, "IPv6: %s",
(curlx_dyn_len(&out[1]) ? curlx_dyn_ptr(&out[1]) : "(none)"));
#endif
infof(data, "IPv4: %s",
(curlx_dyn_len(&out[0]) ? curlx_dyn_ptr(&out[0]) : "(none)"));

fail:
curlx_dyn_free(&out[0]);
#ifdef CURLRES_IPV6
curlx_dyn_free(&out[1]);
#endif
}
#else
#define show_resolve_info(x, y) Curl_nop_stmt
#endif
Expand Down Expand Up @@ -1422,71 +1482,6 @@ CURLcode Curl_loadhostpairs(struct Curl_easy *data)
return CURLE_OK;
}

#ifndef CURL_DISABLE_VERBOSE_STRINGS
static void show_resolve_info(struct Curl_easy *data,
struct Curl_dns_entry *dns)
{
struct Curl_addrinfo *a;
CURLcode result = CURLE_OK;
#ifdef CURLRES_IPV6
struct dynbuf out[2];
#else
struct dynbuf out[1];
#endif
DEBUGASSERT(data);
DEBUGASSERT(dns);

if(!data->set.verbose ||
/* ignore no name or numerical IP addresses */
!dns->hostname[0] || Curl_host_is_ipnum(dns->hostname))
return;

a = dns->addr;

infof(data, "Host %s:%d was resolved.",
(dns->hostname[0] ? dns->hostname : "(none)"), dns->hostport);

curlx_dyn_init(&out[0], 1024);
#ifdef CURLRES_IPV6
curlx_dyn_init(&out[1], 1024);
#endif

while(a) {
if(
#ifdef CURLRES_IPV6
a->ai_family == PF_INET6 ||
#endif
a->ai_family == PF_INET) {
char buf[MAX_IPADR_LEN];
struct dynbuf *d = &out[(a->ai_family != PF_INET)];
Curl_printable_address(a, buf, sizeof(buf));
if(curlx_dyn_len(d))
result = curlx_dyn_addn(d, ", ", 2);
if(!result)
result = curlx_dyn_add(d, buf);
if(result) {
infof(data, "too many IP, cannot show");
goto fail;
}
}
a = a->ai_next;
}

#ifdef CURLRES_IPV6
infof(data, "IPv6: %s",
(curlx_dyn_len(&out[1]) ? curlx_dyn_ptr(&out[1]) : "(none)"));
#endif
infof(data, "IPv4: %s",
(curlx_dyn_len(&out[0]) ? curlx_dyn_ptr(&out[0]) : "(none)"));

fail:
curlx_dyn_free(&out[0]);
#ifdef CURLRES_IPV6
curlx_dyn_free(&out[1]);
#endif
}
#endif

#ifdef USE_CURL_ASYNC
CURLcode Curl_resolv_check(struct Curl_easy *data,
struct Curl_dns_entry **dns)
Expand Down
2 changes: 0 additions & 2 deletions lib/urldata.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,6 @@
#define PORT_MQTT 1883
#define PORT_MQTTS 8883

struct curl_trc_featt;

#ifdef USE_ECH
/* CURLECH_ bits for the tls_ech option */
# define CURLECH_DISABLE (1 << 0)
Expand Down