Curl_resolver_is_resolved: show proper host name on failed resolve
This commit is contained in:
parent
52b5eadf3c
commit
25e577b33d
@ -430,8 +430,19 @@ static const char *gai_strerror(int ecode)
|
|||||||
* error
|
* error
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static void resolver_error(struct connectdata *conn, const char *host_or_proxy)
|
static CURLcode resolver_error(struct connectdata *conn)
|
||||||
{
|
{
|
||||||
|
const char *host_or_proxy;
|
||||||
|
CURLcode rc;
|
||||||
|
if(conn->bits.httpproxy) {
|
||||||
|
host_or_proxy = "proxy";
|
||||||
|
rc = CURLE_COULDNT_RESOLVE_PROXY;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
host_or_proxy = "host";
|
||||||
|
rc = CURLE_COULDNT_RESOLVE_HOST;
|
||||||
|
}
|
||||||
|
|
||||||
failf(conn->data, "Could not resolve %s: %s; %s", host_or_proxy,
|
failf(conn->data, "Could not resolve %s: %s; %s", host_or_proxy,
|
||||||
conn->async.hostname,
|
conn->async.hostname,
|
||||||
#ifdef HAVE_GAI_STRERROR
|
#ifdef HAVE_GAI_STRERROR
|
||||||
@ -442,6 +453,7 @@ static void resolver_error(struct connectdata *conn, const char *host_or_proxy)
|
|||||||
Curl_strerror(conn, conn->async.status)
|
Curl_strerror(conn, conn->async.status)
|
||||||
#endif
|
#endif
|
||||||
);
|
);
|
||||||
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -473,17 +485,9 @@ CURLcode Curl_resolver_wait_resolv(struct connectdata *conn,
|
|||||||
if(entry)
|
if(entry)
|
||||||
*entry = conn->async.dns;
|
*entry = conn->async.dns;
|
||||||
|
|
||||||
if(!conn->async.dns) {
|
if(!conn->async.dns)
|
||||||
/* a name was not resolved */
|
/* a name was not resolved, report error */
|
||||||
if(conn->bits.httpproxy) {
|
rc = resolver_error(conn);
|
||||||
resolver_error(conn, "proxy");
|
|
||||||
rc = CURLE_COULDNT_RESOLVE_PROXY;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
resolver_error(conn, "host");
|
|
||||||
rc = CURLE_COULDNT_RESOLVE_HOST;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
destroy_async_data(&conn->async);
|
destroy_async_data(&conn->async);
|
||||||
|
|
||||||
@ -518,12 +522,13 @@ CURLcode Curl_resolver_is_resolved(struct connectdata *conn,
|
|||||||
|
|
||||||
if(done) {
|
if(done) {
|
||||||
getaddrinfo_complete(conn);
|
getaddrinfo_complete(conn);
|
||||||
destroy_async_data(&conn->async);
|
|
||||||
|
|
||||||
if(!conn->async.dns) {
|
if(!conn->async.dns) {
|
||||||
resolver_error(conn, "host");
|
CURLcode rc = resolver_error(conn);
|
||||||
return CURLE_COULDNT_RESOLVE_HOST;
|
destroy_async_data(&conn->async);
|
||||||
|
return rc;
|
||||||
}
|
}
|
||||||
|
destroy_async_data(&conn->async);
|
||||||
*entry = conn->async.dns;
|
*entry = conn->async.dns;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user