2004-04-26 09:20:11 +02:00
|
|
|
/***************************************************************************
|
2004-06-24 09:43:48 +02:00
|
|
|
* _ _ ____ _
|
|
|
|
* Project ___| | | | _ \| |
|
|
|
|
* / __| | | | |_) | |
|
|
|
|
* | (__| |_| | _ <| |___
|
2004-04-26 09:20:11 +02:00
|
|
|
* \___|\___/|_| \_\_____|
|
|
|
|
*
|
2010-01-07 00:04:17 +01:00
|
|
|
* Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, et al.
|
2004-04-26 09:20:11 +02:00
|
|
|
*
|
|
|
|
* This software is licensed as described in the file COPYING, which
|
|
|
|
* you should have received as part of this distribution. The terms
|
|
|
|
* are also available at http://curl.haxx.se/docs/copyright.html.
|
2004-06-24 09:43:48 +02:00
|
|
|
*
|
2004-04-26 09:20:11 +02:00
|
|
|
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
|
|
|
* copies of the Software, and permit persons to whom the Software is
|
|
|
|
* furnished to do so, under the terms of the COPYING file.
|
|
|
|
*
|
|
|
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
|
|
|
* KIND, either express or implied.
|
|
|
|
*
|
|
|
|
* $Id$
|
|
|
|
***************************************************************************/
|
|
|
|
|
|
|
|
#include "setup.h"
|
|
|
|
|
|
|
|
#include <string.h>
|
|
|
|
|
2009-04-14 15:50:32 +02:00
|
|
|
#ifdef HAVE_LIMITS_H
|
|
|
|
#include <limits.h>
|
|
|
|
#endif
|
2004-04-26 09:20:11 +02:00
|
|
|
#ifdef HAVE_SYS_SOCKET_H
|
|
|
|
#include <sys/socket.h>
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE_NETINET_IN_H
|
|
|
|
#include <netinet/in.h>
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE_NETDB_H
|
|
|
|
#include <netdb.h>
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE_ARPA_INET_H
|
|
|
|
#include <arpa/inet.h>
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE_STDLIB_H
|
2004-10-06 09:50:18 +02:00
|
|
|
#include <stdlib.h> /* required for free() prototypes */
|
2004-04-26 09:20:11 +02:00
|
|
|
#endif
|
|
|
|
#ifdef HAVE_UNISTD_H
|
|
|
|
#include <unistd.h> /* for the close() proto */
|
|
|
|
#endif
|
2009-12-30 18:59:56 +01:00
|
|
|
#ifdef __VMS
|
2004-04-26 09:20:11 +02:00
|
|
|
#include <in.h>
|
|
|
|
#include <inet.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#endif
|
|
|
|
|
2006-04-26 19:23:28 +02:00
|
|
|
#ifdef HAVE_PROCESS_H
|
2004-04-26 09:20:11 +02:00
|
|
|
#include <process.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if (defined(NETWARE) && defined(__NOVELL_LIBC__))
|
|
|
|
#undef in_addr_t
|
|
|
|
#define in_addr_t unsigned long
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "urldata.h"
|
|
|
|
#include "sendf.h"
|
|
|
|
#include "hostip.h"
|
|
|
|
#include "hash.h"
|
|
|
|
#include "share.h"
|
|
|
|
#include "strerror.h"
|
|
|
|
#include "url.h"
|
2006-10-17 10:06:27 +02:00
|
|
|
#include "multiif.h"
|
2008-08-21 01:32:50 +02:00
|
|
|
#include "inet_pton.h"
|
2007-02-16 19:19:35 +01:00
|
|
|
#include "connect.h"
|
2007-03-27 20:15:26 +02:00
|
|
|
#include "select.h"
|
2010-01-07 00:04:17 +01:00
|
|
|
#include "progress.h"
|
2004-04-26 09:20:11 +02:00
|
|
|
|
|
|
|
#define _MPRINTF_REPLACE /* use our functions only */
|
|
|
|
#include <curl/mprintf.h>
|
|
|
|
|
2009-04-21 13:46:16 +02:00
|
|
|
#include "curl_memory.h"
|
2004-04-26 09:20:11 +02:00
|
|
|
/* The last #include file should be: */
|
|
|
|
#include "memdebug.h"
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* Only for ares-enabled builds
|
|
|
|
**********************************************************************/
|
|
|
|
|
|
|
|
#ifdef CURLRES_ARES
|
|
|
|
|
|
|
|
/*
|
2005-02-09 14:06:40 +01:00
|
|
|
* Curl_resolv_fdset() is called when someone from the outside world (using
|
2004-04-26 09:20:11 +02:00
|
|
|
* curl_multi_fdset()) wants to get our fd_set setup and we're talking with
|
|
|
|
* ares. The caller must make sure that this function is only called when we
|
|
|
|
* have a working ares channel.
|
|
|
|
*
|
|
|
|
* Returns: CURLE_OK always!
|
|
|
|
*/
|
|
|
|
|
2006-04-10 17:00:53 +02:00
|
|
|
int Curl_resolv_getsock(struct connectdata *conn,
|
|
|
|
curl_socket_t *socks,
|
|
|
|
int numsocks)
|
2004-04-26 09:20:11 +02:00
|
|
|
|
|
|
|
{
|
2006-10-17 10:06:27 +02:00
|
|
|
struct timeval maxtime;
|
2007-10-03 15:19:34 +02:00
|
|
|
struct timeval timebuf;
|
|
|
|
struct timeval *timeout;
|
2006-04-10 17:00:53 +02:00
|
|
|
int max = ares_getsock(conn->data->state.areschannel,
|
|
|
|
(int *)socks, numsocks);
|
2004-04-26 09:20:11 +02:00
|
|
|
|
2006-10-17 10:06:27 +02:00
|
|
|
|
|
|
|
maxtime.tv_sec = CURL_TIMEOUT_RESOLVE;
|
|
|
|
maxtime.tv_usec = 0;
|
|
|
|
|
2007-10-03 15:19:34 +02:00
|
|
|
timeout = ares_timeout(conn->data->state.areschannel, &maxtime, &timebuf);
|
2006-10-17 10:06:27 +02:00
|
|
|
|
|
|
|
Curl_expire(conn->data,
|
2007-10-03 15:19:34 +02:00
|
|
|
(timeout->tv_sec * 1000) + (timeout->tv_usec/1000));
|
2006-10-17 10:06:27 +02:00
|
|
|
|
2006-04-10 17:00:53 +02:00
|
|
|
return max;
|
2004-04-26 09:20:11 +02:00
|
|
|
}
|
|
|
|
|
2007-05-31 13:34:32 +02:00
|
|
|
/*
|
2010-01-07 00:04:17 +01:00
|
|
|
* waitperform()
|
2007-05-31 13:34:32 +02:00
|
|
|
*
|
|
|
|
* 1) Ask ares what sockets it currently plays with, then
|
|
|
|
* 2) wait for the timeout period to check for action on ares' sockets.
|
|
|
|
* 3) tell ares to act on all the sockets marked as "with action"
|
|
|
|
*
|
|
|
|
* return number of sockets it worked on
|
|
|
|
*/
|
|
|
|
|
2010-01-07 00:04:17 +01:00
|
|
|
static int waitperform(struct connectdata *conn, int timeout_ms)
|
2007-05-31 13:34:32 +02:00
|
|
|
{
|
|
|
|
struct SessionHandle *data = conn->data;
|
|
|
|
int nfds;
|
|
|
|
int bitmask;
|
|
|
|
int socks[ARES_GETSOCK_MAXNUM];
|
|
|
|
struct pollfd pfd[ARES_GETSOCK_MAXNUM];
|
|
|
|
int i;
|
2008-04-29 06:18:02 +02:00
|
|
|
int num = 0;
|
2007-05-31 13:34:32 +02:00
|
|
|
|
|
|
|
bitmask = ares_getsock(data->state.areschannel, socks, ARES_GETSOCK_MAXNUM);
|
|
|
|
|
|
|
|
for(i=0; i < ARES_GETSOCK_MAXNUM; i++) {
|
|
|
|
pfd[i].events = 0;
|
2008-04-29 06:18:02 +02:00
|
|
|
pfd[i].revents = 0;
|
2007-05-31 13:34:32 +02:00
|
|
|
if(ARES_GETSOCK_READABLE(bitmask, i)) {
|
|
|
|
pfd[i].fd = socks[i];
|
|
|
|
pfd[i].events |= POLLRDNORM|POLLIN;
|
|
|
|
}
|
|
|
|
if(ARES_GETSOCK_WRITABLE(bitmask, i)) {
|
|
|
|
pfd[i].fd = socks[i];
|
|
|
|
pfd[i].events |= POLLWRNORM|POLLOUT;
|
|
|
|
}
|
2008-04-29 06:18:02 +02:00
|
|
|
if(pfd[i].events != 0)
|
|
|
|
num++;
|
|
|
|
else
|
2007-05-31 13:34:32 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(num)
|
|
|
|
nfds = Curl_poll(pfd, num, timeout_ms);
|
|
|
|
else
|
|
|
|
nfds = 0;
|
|
|
|
|
|
|
|
if(!nfds)
|
|
|
|
/* Call ares_process() unconditonally here, even if we simply timed out
|
|
|
|
above, as otherwise the ares name resolve won't timeout! */
|
|
|
|
ares_process_fd(data->state.areschannel, ARES_SOCKET_BAD, ARES_SOCKET_BAD);
|
|
|
|
else {
|
|
|
|
/* move through the descriptors and ask for processing on them */
|
|
|
|
for(i=0; i < num; i++)
|
|
|
|
ares_process_fd(data->state.areschannel,
|
2009-09-15 02:07:25 +02:00
|
|
|
pfd[i].revents & (POLLRDNORM|POLLIN)?
|
2007-05-31 13:34:32 +02:00
|
|
|
pfd[i].fd:ARES_SOCKET_BAD,
|
2009-09-15 02:07:25 +02:00
|
|
|
pfd[i].revents & (POLLWRNORM|POLLOUT)?
|
2007-05-31 13:34:32 +02:00
|
|
|
pfd[i].fd:ARES_SOCKET_BAD);
|
|
|
|
}
|
|
|
|
return nfds;
|
|
|
|
}
|
|
|
|
|
2004-04-26 09:20:11 +02:00
|
|
|
/*
|
|
|
|
* Curl_is_resolved() is called repeatedly to check if a previous name resolve
|
|
|
|
* request has completed. It should also make sure to time-out if the
|
|
|
|
* operation seems to take too long.
|
|
|
|
*
|
|
|
|
* Returns normal CURLcode errors.
|
|
|
|
*/
|
|
|
|
CURLcode Curl_is_resolved(struct connectdata *conn,
|
|
|
|
struct Curl_dns_entry **dns)
|
|
|
|
{
|
|
|
|
struct SessionHandle *data = conn->data;
|
|
|
|
|
|
|
|
*dns = NULL;
|
|
|
|
|
2010-01-07 00:04:17 +01:00
|
|
|
waitperform(conn, 0);
|
2007-05-31 13:34:32 +02:00
|
|
|
|
2004-04-26 09:20:11 +02:00
|
|
|
if(conn->async.done) {
|
|
|
|
/* we're done, kill the ares handle */
|
2004-05-06 13:10:51 +02:00
|
|
|
if(!conn->async.dns) {
|
2004-05-07 08:18:47 +02:00
|
|
|
failf(data, "Could not resolve host: %s (%s)", conn->host.dispname,
|
2004-05-06 13:10:51 +02:00
|
|
|
ares_strerror(conn->async.status));
|
2004-04-26 09:20:11 +02:00
|
|
|
return CURLE_COULDNT_RESOLVE_HOST;
|
2004-05-06 13:10:51 +02:00
|
|
|
}
|
2004-04-26 09:20:11 +02:00
|
|
|
*dns = conn->async.dns;
|
|
|
|
}
|
|
|
|
|
|
|
|
return CURLE_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Curl_wait_for_resolv() waits for a resolve to finish. This function should
|
|
|
|
* be avoided since using this risk getting the multi interface to "hang".
|
|
|
|
*
|
|
|
|
* If 'entry' is non-NULL, make it point to the resolved dns entry
|
|
|
|
*
|
|
|
|
* Returns CURLE_COULDNT_RESOLVE_HOST if the host was not resolved, and
|
|
|
|
* CURLE_OPERATION_TIMEDOUT if a time-out occurred.
|
|
|
|
*/
|
|
|
|
CURLcode Curl_wait_for_resolv(struct connectdata *conn,
|
|
|
|
struct Curl_dns_entry **entry)
|
|
|
|
{
|
|
|
|
CURLcode rc=CURLE_OK;
|
|
|
|
struct SessionHandle *data = conn->data;
|
2007-02-05 23:51:32 +01:00
|
|
|
long timeout;
|
2008-04-29 06:18:02 +02:00
|
|
|
struct timeval now = Curl_tvnow();
|
2004-04-26 09:20:11 +02:00
|
|
|
|
|
|
|
/* now, see if there's a connect timeout or a regular timeout to
|
|
|
|
use instead of the default one */
|
|
|
|
if(conn->data->set.connecttimeout)
|
|
|
|
timeout = conn->data->set.connecttimeout;
|
|
|
|
else if(conn->data->set.timeout)
|
|
|
|
timeout = conn->data->set.timeout;
|
|
|
|
else
|
2007-02-05 23:51:32 +01:00
|
|
|
timeout = CURL_TIMEOUT_RESOLVE * 1000; /* default name resolve timeout */
|
2004-04-26 09:20:11 +02:00
|
|
|
|
|
|
|
/* Wait for the name resolve query to complete. */
|
2007-11-07 10:21:35 +01:00
|
|
|
while(1) {
|
2004-04-26 09:20:11 +02:00
|
|
|
struct timeval *tvp, tv, store;
|
|
|
|
long timediff;
|
2008-04-29 06:18:02 +02:00
|
|
|
int itimeout;
|
2010-01-07 00:04:17 +01:00
|
|
|
int timeout_ms;
|
2004-04-26 09:20:11 +02:00
|
|
|
|
2008-04-29 06:18:02 +02:00
|
|
|
itimeout = (timeout > (long)INT_MAX) ? INT_MAX : (int)timeout;
|
|
|
|
|
|
|
|
store.tv_sec = itimeout/1000;
|
|
|
|
store.tv_usec = (itimeout%1000)*1000;
|
2004-06-24 09:43:48 +02:00
|
|
|
|
2004-04-26 09:20:11 +02:00
|
|
|
tvp = ares_timeout(data->state.areschannel, &store, &tv);
|
|
|
|
|
2010-01-07 00:04:17 +01:00
|
|
|
/* use the timeout period ares returned to us above if less than one
|
|
|
|
second is left, otherwise just use 1000ms to make sure the progress
|
|
|
|
callback gets called frequent enough */
|
|
|
|
if(!tvp->tv_sec)
|
|
|
|
timeout_ms = tvp->tv_usec/1000;
|
|
|
|
else
|
|
|
|
timeout_ms = 1000;
|
|
|
|
|
|
|
|
waitperform(conn, timeout_ms);
|
2007-06-11 15:32:49 +02:00
|
|
|
|
|
|
|
if(conn->async.done)
|
2007-05-31 13:34:32 +02:00
|
|
|
break;
|
2004-04-26 09:20:11 +02:00
|
|
|
|
2010-01-07 00:04:17 +01:00
|
|
|
if(Curl_pgrsUpdate(conn)) {
|
|
|
|
rc = CURLE_ABORTED_BY_CALLBACK;
|
|
|
|
timeout = -1; /* trigger the cancel below */
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
timediff = Curl_tvdiff(Curl_tvnow(), now); /* spent time */
|
|
|
|
timeout -= timediff?timediff:1; /* always deduct at least 1 */
|
|
|
|
}
|
2007-11-07 10:21:35 +01:00
|
|
|
if(timeout < 0) {
|
2004-04-26 09:20:11 +02:00
|
|
|
/* our timeout, so we cancel the ares operation */
|
|
|
|
ares_cancel(data->state.areschannel);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Operation complete, if the lookup was successful we now have the entry
|
|
|
|
in the cache. */
|
2004-06-24 09:43:48 +02:00
|
|
|
|
2004-04-26 09:20:11 +02:00
|
|
|
if(entry)
|
|
|
|
*entry = conn->async.dns;
|
|
|
|
|
|
|
|
if(!conn->async.dns) {
|
|
|
|
/* a name was not resolved */
|
|
|
|
if((timeout < 0) || (conn->async.status == ARES_ETIMEOUT)) {
|
2010-01-26 23:59:43 +01:00
|
|
|
if (conn->bits.httpproxy) {
|
|
|
|
failf(data, "Resolving proxy timed out: %s", conn->proxy.dispname);
|
|
|
|
rc = CURLE_COULDNT_RESOLVE_PROXY;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
failf(data, "Resolving host timed out: %s", conn->host.dispname);
|
|
|
|
rc = CURLE_COULDNT_RESOLVE_HOST;
|
|
|
|
}
|
2004-04-26 09:20:11 +02:00
|
|
|
}
|
|
|
|
else if(conn->async.done) {
|
2010-01-26 23:59:43 +01:00
|
|
|
if (conn->bits.httpproxy) {
|
|
|
|
failf(data, "Could not resolve proxy: %s (%s)", conn->proxy.dispname,
|
|
|
|
ares_strerror(conn->async.status));
|
|
|
|
rc = CURLE_COULDNT_RESOLVE_PROXY;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
failf(data, "Could not resolve host: %s (%s)", conn->host.dispname,
|
|
|
|
ares_strerror(conn->async.status));
|
|
|
|
rc = CURLE_COULDNT_RESOLVE_HOST;
|
|
|
|
}
|
2004-04-26 09:20:11 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
rc = CURLE_OPERATION_TIMEDOUT;
|
|
|
|
|
|
|
|
/* close the connection, since we can't return failure here without
|
|
|
|
cleaning up this connection properly */
|
2005-02-08 08:36:57 +01:00
|
|
|
conn->bits.close = TRUE;
|
2004-04-26 09:20:11 +02:00
|
|
|
}
|
2004-06-24 09:43:48 +02:00
|
|
|
|
2004-04-26 09:20:11 +02:00
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
2010-01-22 07:36:52 +01:00
|
|
|
/*
|
|
|
|
* ares_query_completed_cb() is the callback that ares will call when
|
|
|
|
* the host query initiated by ares_gethostbyname() from Curl_getaddrinfo(),
|
|
|
|
* when using ares, is completed either successfully or with failure.
|
|
|
|
*/
|
|
|
|
static void ares_query_completed_cb(void *arg, /* (struct connectdata *) */
|
|
|
|
int status,
|
|
|
|
#ifdef HAVE_CARES_CALLBACK_TIMEOUTS
|
|
|
|
int timeouts,
|
|
|
|
#endif
|
|
|
|
struct hostent *hostent)
|
|
|
|
{
|
|
|
|
struct connectdata *conn = (struct connectdata *)arg;
|
|
|
|
struct Curl_addrinfo * ai = NULL;
|
2010-01-26 23:59:43 +01:00
|
|
|
|
2010-01-22 07:36:52 +01:00
|
|
|
#ifdef HAVE_CARES_CALLBACK_TIMEOUTS
|
|
|
|
(void)timeouts; /* ignored */
|
|
|
|
#endif
|
|
|
|
|
|
|
|
if (status == CURL_ASYNC_SUCCESS) {
|
|
|
|
ai = Curl_he2ai(hostent, conn->async.port);
|
|
|
|
}
|
2010-01-26 23:59:43 +01:00
|
|
|
|
2010-01-22 07:36:52 +01:00
|
|
|
(void)Curl_addrinfo_callback(arg, status, ai);
|
|
|
|
}
|
2008-07-09 20:39:49 +02:00
|
|
|
|
2004-04-26 09:20:11 +02:00
|
|
|
/*
|
|
|
|
* Curl_getaddrinfo() - when using ares
|
|
|
|
*
|
|
|
|
* Returns name information about the given hostname and port number. If
|
|
|
|
* successful, the 'hostent' is returned and the forth argument will point to
|
|
|
|
* memory we need to free after use. That memory *MUST* be freed with
|
|
|
|
* Curl_freeaddrinfo(), nothing else.
|
|
|
|
*/
|
|
|
|
Curl_addrinfo *Curl_getaddrinfo(struct connectdata *conn,
|
2006-07-21 07:51:12 +02:00
|
|
|
const char *hostname,
|
2004-04-26 09:20:11 +02:00
|
|
|
int port,
|
|
|
|
int *waitp)
|
|
|
|
{
|
|
|
|
char *bufp;
|
|
|
|
struct SessionHandle *data = conn->data;
|
2008-11-06 18:19:56 +01:00
|
|
|
struct in_addr in;
|
2008-07-09 20:39:49 +02:00
|
|
|
int family = PF_INET;
|
|
|
|
#ifdef ENABLE_IPV6 /* CURLRES_IPV6 */
|
|
|
|
struct in6_addr in6;
|
|
|
|
#endif /* CURLRES_IPV6 */
|
2010-01-26 00:50:13 +01:00
|
|
|
|
|
|
|
*waitp = 0; /* default to synchronous response */
|
2004-06-24 09:43:48 +02:00
|
|
|
|
2008-11-06 18:19:56 +01:00
|
|
|
/* First check if this is an IPv4 address string */
|
|
|
|
if(Curl_inet_pton(AF_INET, hostname, &in) > 0) {
|
2004-04-26 09:20:11 +02:00
|
|
|
/* This is a dotted IP address 123.123.123.123-style */
|
2008-11-06 18:19:56 +01:00
|
|
|
return Curl_ip2addr(AF_INET, &in, hostname, port);
|
2004-06-24 09:43:48 +02:00
|
|
|
}
|
2004-04-26 09:20:11 +02:00
|
|
|
|
2008-07-09 20:39:49 +02:00
|
|
|
#ifdef ENABLE_IPV6 /* CURLRES_IPV6 */
|
2008-11-06 18:19:56 +01:00
|
|
|
/* Otherwise, check if this is an IPv6 address string */
|
2008-08-21 01:32:50 +02:00
|
|
|
if (Curl_inet_pton (AF_INET6, hostname, &in6) > 0) {
|
2008-07-09 20:39:49 +02:00
|
|
|
/* This must be an IPv6 address literal. */
|
2008-11-06 18:19:56 +01:00
|
|
|
return Curl_ip2addr(AF_INET6, &in6, hostname, port);
|
2008-07-09 20:39:49 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
switch(data->set.ip_version) {
|
2009-01-31 21:25:55 +01:00
|
|
|
default:
|
|
|
|
#if ARES_VERSION >= 0x010601
|
|
|
|
family = PF_UNSPEC; /* supported by c-ares since 1.6.1, so for older
|
|
|
|
c-ares versions this just falls through and defaults
|
|
|
|
to PF_INET */
|
|
|
|
break;
|
|
|
|
#endif
|
2008-07-09 20:39:49 +02:00
|
|
|
case CURL_IPRESOLVE_V4:
|
|
|
|
family = PF_INET;
|
|
|
|
break;
|
|
|
|
case CURL_IPRESOLVE_V6:
|
|
|
|
family = PF_INET6;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
#endif /* CURLRES_IPV6 */
|
|
|
|
|
2004-04-26 09:20:11 +02:00
|
|
|
bufp = strdup(hostname);
|
|
|
|
|
|
|
|
if(bufp) {
|
|
|
|
Curl_safefree(conn->async.hostname);
|
|
|
|
conn->async.hostname = bufp;
|
|
|
|
conn->async.port = port;
|
|
|
|
conn->async.done = FALSE; /* not done */
|
|
|
|
conn->async.status = 0; /* clear */
|
|
|
|
conn->async.dns = NULL; /* clear */
|
|
|
|
|
|
|
|
/* areschannel is already setup in the Curl_open() function */
|
2008-07-09 20:39:49 +02:00
|
|
|
ares_gethostbyname(data->state.areschannel, hostname, family,
|
2010-01-22 07:36:52 +01:00
|
|
|
(ares_host_callback)ares_query_completed_cb, conn);
|
2004-06-24 09:43:48 +02:00
|
|
|
|
2010-01-26 00:50:13 +01:00
|
|
|
*waitp = 1; /* expect asynchronous response */
|
2004-04-26 09:20:11 +02:00
|
|
|
}
|
|
|
|
return NULL; /* no struct yet */
|
|
|
|
}
|
|
|
|
#endif /* CURLRES_ARES */
|