aboutsummaryrefslogtreecommitdiff
path: root/lib/hostip.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2003-10-04 14:50:45 +0000
committerDaniel Stenberg <daniel@haxx.se>2003-10-04 14:50:45 +0000
commit343291ce37acbeece395734a80f3d7dc771f610f (patch)
tree2334a9074379360a338f855a4b06f32f25e2839e /lib/hostip.c
parentb864e25011ff109307bcac8fffffc3aeb983aaec (diff)
Based on a patch provided by Siddhartha Prakash Jain. In Curl_resolv() when
my_getaddrinfo() has been called (and wait has been set to TRUE), we check if the name already is resolved and if so don't return wait status to the parent. This can happen with IP-only names.
Diffstat (limited to 'lib/hostip.c')
-rw-r--r--lib/hostip.c27
1 files changed, 18 insertions, 9 deletions
diff --git a/lib/hostip.c b/lib/hostip.c
index 1a881cf9b..8b1e80d47 100644
--- a/lib/hostip.c
+++ b/lib/hostip.c
@@ -320,10 +320,16 @@ int Curl_resolv(struct connectdata *conn,
Curl_addrinfo *addr = my_getaddrinfo(conn, hostname, port, &wait);
if (!addr) {
- if(wait)
+ if(wait) {
/* the response to our resolve call will come asynchronously at
a later time, good or bad */
- rc = 1;
+ /* First, check that we haven't received the info by now */
+ (void)Curl_is_resolved(conn, &dns);
+ if(dns)
+ rc = 0; /* pointer provided */
+ else
+ rc = 1; /* no info yet */
+ }
}
else
/* we got a response, store it in the cache */
@@ -401,7 +407,8 @@ CURLcode Curl_multi_ares_fdset(struct connectdata *conn,
}
/* called to check if the name is resolved now */
-CURLcode Curl_is_resolved(struct connectdata *conn, bool *done)
+CURLcode Curl_is_resolved(struct connectdata *conn,
+ struct Curl_dns_entry **dns)
{
fd_set read_fds, write_fds;
static const struct timeval tv={0,0};
@@ -419,12 +426,12 @@ CURLcode Curl_is_resolved(struct connectdata *conn, bool *done)
if(count)
ares_process(data->state.areschannel, &read_fds, &write_fds);
- *done = FALSE;
+ *dns = NULL;
if(conn->async.done) {
if(!conn->async.dns)
return CURLE_COULDNT_RESOLVE_HOST;
- *done = TRUE;
+ *dns = conn->async.dns;
}
return CURLE_OK;
@@ -557,7 +564,8 @@ static Curl_addrinfo *my_getaddrinfo(struct connectdata *conn,
ares_gethostbyname(data->state.areschannel, hostname, PF_INET,
host_callback, conn);
- *waitp = TRUE; /* please wait for the response */
+
+ *waitp = TRUE; /* please wait for the response */
}
else
ares_destroy(data->state.areschannel);
@@ -590,12 +598,13 @@ CURLcode Curl_multi_ares_fdset(struct connectdata *conn,
return CURLE_OK;
}
-CURLcode Curl_is_resolved(struct connectdata *conn, bool *done)
+CURLcode Curl_is_resolved(struct connectdata *conn,
+ struct Curl_dns_entry **dns)
{
(void)conn;
- *done = TRUE;
+ *dns = NULL;
- return CURLE_OK;
+ return CURLE_COULDNT_RESOLVE_HOST;
}
#endif