Curl_resolver_is_resolved: differentiate between host/proxy errors
authorDaniel Stenberg <daniel@haxx.se>
Mon, 5 Dec 2011 11:44:55 +0000 (12:44 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Mon, 5 Dec 2011 11:44:55 +0000 (12:44 +0100)
As there are different return codes for host vs proxy errors, this function
now properly returns the code properly depending on what was attempted to get
resolved.

Bug: http://curl.haxx.se/mail/archive-2011-12/0010.html
Reported by: Jason Liu

lib/asyn-ares.c

index f08a4d8..9f16e39 100644 (file)
@@ -331,9 +331,12 @@ CURLcode Curl_resolver_is_resolved(struct connectdata *conn,
     res->temp_ai = NULL;
     destroy_async_data(&conn->async);
     if(!conn->async.dns) {
-      failf(data, "Could not resolve host: %s (%s)", conn->host.dispname,
+      failf(data, "Could not resolve %s: %s (%s)",
+            conn->bits.proxy?"proxy":"host",
+            conn->host.dispname,
             ares_strerror(conn->async.status));
-      return CURLE_COULDNT_RESOLVE_HOST;
+      return conn->bits.proxy?CURLE_COULDNT_RESOLVE_PROXY:
+        CURLE_COULDNT_RESOLVE_HOST;
     }
     *dns = conn->async.dns;
   }