|
|
3a27f0 |
From 74d01a8e4d48eedc526cffaf6a6bc782b139e068 Mon Sep 17 00:00:00 2001
|
|
|
3a27f0 |
From: Kim Vandry <vandry@users.sf.net>
|
|
|
3a27f0 |
Date: Mon, 18 Feb 2013 21:36:34 +0100
|
|
|
3a27f0 |
Subject: [PATCH 1/2] Curl_resolver_is_resolved: show proper host name on failed resolve
|
|
|
3a27f0 |
|
|
|
3a27f0 |
[upstream commit 25e577b33d00afb6630cf2cac98d6baa319e9aef]
|
|
|
3a27f0 |
|
|
|
3a27f0 |
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
|
|
|
3a27f0 |
---
|
|
|
3a27f0 |
lib/asyn-thread.c | 35 ++++++++++++++++++++---------------
|
|
|
3a27f0 |
1 files changed, 20 insertions(+), 15 deletions(-)
|
|
|
3a27f0 |
|
|
|
3a27f0 |
diff --git a/lib/asyn-thread.c b/lib/asyn-thread.c
|
|
|
3a27f0 |
index 7a8294d..c392b21 100644
|
|
|
3a27f0 |
--- a/lib/asyn-thread.c
|
|
|
3a27f0 |
+++ b/lib/asyn-thread.c
|
|
|
3a27f0 |
@@ -430,8 +430,19 @@ static const char *gai_strerror(int ecode)
|
|
|
3a27f0 |
* error
|
|
|
3a27f0 |
*/
|
|
|
3a27f0 |
|
|
|
3a27f0 |
-static void resolver_error(struct connectdata *conn, const char *host_or_proxy)
|
|
|
3a27f0 |
+static CURLcode resolver_error(struct connectdata *conn)
|
|
|
3a27f0 |
{
|
|
|
3a27f0 |
+ const char *host_or_proxy;
|
|
|
3a27f0 |
+ CURLcode rc;
|
|
|
3a27f0 |
+ if(conn->bits.httpproxy) {
|
|
|
3a27f0 |
+ host_or_proxy = "proxy";
|
|
|
3a27f0 |
+ rc = CURLE_COULDNT_RESOLVE_PROXY;
|
|
|
3a27f0 |
+ }
|
|
|
3a27f0 |
+ else {
|
|
|
3a27f0 |
+ host_or_proxy = "host";
|
|
|
3a27f0 |
+ rc = CURLE_COULDNT_RESOLVE_HOST;
|
|
|
3a27f0 |
+ }
|
|
|
3a27f0 |
+
|
|
|
3a27f0 |
failf(conn->data, "Could not resolve %s: %s; %s", host_or_proxy,
|
|
|
3a27f0 |
conn->async.hostname,
|
|
|
3a27f0 |
#ifdef HAVE_GAI_STRERROR
|
|
|
3a27f0 |
@@ -442,6 +453,7 @@ static void resolver_error(struct connectdata *conn, const char *host_or_proxy)
|
|
|
3a27f0 |
Curl_strerror(conn, conn->async.status)
|
|
|
3a27f0 |
#endif
|
|
|
3a27f0 |
);
|
|
|
3a27f0 |
+ return rc;
|
|
|
3a27f0 |
}
|
|
|
3a27f0 |
|
|
|
3a27f0 |
/*
|
|
|
3a27f0 |
@@ -473,17 +485,9 @@ CURLcode Curl_resolver_wait_resolv(struct connectdata *conn,
|
|
|
3a27f0 |
if(entry)
|
|
|
3a27f0 |
*entry = conn->async.dns;
|
|
|
3a27f0 |
|
|
|
3a27f0 |
- if(!conn->async.dns) {
|
|
|
3a27f0 |
- /* a name was not resolved */
|
|
|
3a27f0 |
- if(conn->bits.httpproxy) {
|
|
|
3a27f0 |
- resolver_error(conn, "proxy");
|
|
|
3a27f0 |
- rc = CURLE_COULDNT_RESOLVE_PROXY;
|
|
|
3a27f0 |
- }
|
|
|
3a27f0 |
- else {
|
|
|
3a27f0 |
- resolver_error(conn, "host");
|
|
|
3a27f0 |
- rc = CURLE_COULDNT_RESOLVE_HOST;
|
|
|
3a27f0 |
- }
|
|
|
3a27f0 |
- }
|
|
|
3a27f0 |
+ if(!conn->async.dns)
|
|
|
3a27f0 |
+ /* a name was not resolved, report error */
|
|
|
3a27f0 |
+ rc = resolver_error(conn);
|
|
|
3a27f0 |
|
|
|
3a27f0 |
destroy_async_data(&conn->async);
|
|
|
3a27f0 |
|
|
|
3a27f0 |
@@ -518,12 +522,13 @@ CURLcode Curl_resolver_is_resolved(struct connectdata *conn,
|
|
|
3a27f0 |
|
|
|
3a27f0 |
if(done) {
|
|
|
3a27f0 |
getaddrinfo_complete(conn);
|
|
|
3a27f0 |
- destroy_async_data(&conn->async);
|
|
|
3a27f0 |
|
|
|
3a27f0 |
if(!conn->async.dns) {
|
|
|
3a27f0 |
- resolver_error(conn, "host");
|
|
|
3a27f0 |
- return CURLE_COULDNT_RESOLVE_HOST;
|
|
|
3a27f0 |
+ CURLcode rc = resolver_error(conn);
|
|
|
3a27f0 |
+ destroy_async_data(&conn->async);
|
|
|
3a27f0 |
+ return rc;
|
|
|
3a27f0 |
}
|
|
|
3a27f0 |
+ destroy_async_data(&conn->async);
|
|
|
3a27f0 |
*entry = conn->async.dns;
|
|
|
3a27f0 |
}
|
|
|
3a27f0 |
else {
|
|
|
3a27f0 |
--
|
|
|
3a27f0 |
1.7.1
|
|
|
3a27f0 |
|