From 692faeab9f07c23feddc4814e16a138a30cbab06 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Thu, 18 Feb 2021 13:14:55 +0100 Subject: asyn-ares: use consistent resolve error message ... with the help of Curl_resolver_error() which now is moved from asyn-thead.c and is provided globally for this purpose. Follow-up to 35ca04ce1b77636 Makes test 1188 work for c-ares builds Closes #6626 --- lib/hostip.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'lib/hostip.c') diff --git a/lib/hostip.c b/lib/hostip.c index e6a92f2ab..cd27b06af 100644 --- a/lib/hostip.c +++ b/lib/hostip.c @@ -1124,3 +1124,32 @@ CURLcode Curl_once_resolved(struct Curl_easy *data, bool *protocol_done) } return result; } + +/* + * Curl_resolver_error() calls failf() with the appropriate message after a + * resolve error + */ + +CURLcode Curl_resolver_error(struct Curl_easy *data) +{ + const char *host_or_proxy; + CURLcode result; + +#ifndef CURL_DISABLE_PROXY + struct connectdata *conn = data->conn; + if(conn->bits.httpproxy) { + host_or_proxy = "proxy"; + result = CURLE_COULDNT_RESOLVE_PROXY; + } + else +#endif + { + host_or_proxy = "host"; + result = CURLE_COULDNT_RESOLVE_HOST; + } + + failf(data, "Could not resolve %s: %s", host_or_proxy, + data->state.async.hostname); + + return result; +} -- cgit v1.2.1