]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
hostip: show the correct name on proxy resolve error
authorDaniel Stenberg <daniel@haxx.se>
Fri, 4 Apr 2025 10:34:09 +0000 (12:34 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Fri, 4 Apr 2025 12:23:01 +0000 (14:23 +0200)
Regression, probably from 8ded8e5f3f4b6586399 (#16451)

Fixes #16958
Reported-by: Jean-Christophe Amiel
Closes #16961

lib/hostip.c

index f658ac3a39b9f860058620d8ad4c2b11f66ca6cc..c82ffb6a6a82069a244a59537bfecf7c261b8720 100644 (file)
@@ -1494,25 +1494,21 @@ CURLcode Curl_once_resolved(struct Curl_easy *data, bool *protocol_done)
 #ifdef USE_CURL_ASYNC
 CURLcode Curl_resolver_error(struct Curl_easy *data)
 {
-  const char *host_or_proxy;
-  CURLcode result;
+  struct connectdata *conn = data->conn;
+  const char *host_or_proxy = "host";
+  const char *name = conn->host.dispname;
+  CURLcode result = CURLE_COULDNT_RESOLVE_HOST;
 
 #ifndef CURL_DISABLE_PROXY
-  struct connectdata *conn = data->conn;
-  if(conn->bits.httpproxy) {
+  if(conn->bits.proxy) {
     host_or_proxy = "proxy";
     result = CURLE_COULDNT_RESOLVE_PROXY;
+    name = conn->socks_proxy.host.name ? conn->socks_proxy.host.dispname :
+      conn->http_proxy.host.dispname;
   }
-  else
 #endif
-  {
-    host_or_proxy = "host";
-    result = CURLE_COULDNT_RESOLVE_HOST;
-  }
-
-  failf(data, "Could not resolve %s: %s", host_or_proxy,
-        data->conn->host.dispname);
 
+  failf(data, "Could not resolve %s: %s", host_or_proxy, name);
   return result;
 }
 #endif /* USE_CURL_ASYNC */