cURL / Mailing Lists / curl-library / Single Mail

curl-library

RE: Async cancel lengthy DNS lookup

From: Adrian Michel <adrian_at_amichel.com>
Date: Fri, 1 Jan 2010 08:50:46 -0800

I managed to get libcurl to use c-ares as dns resolver. I then I tested with
a domain that can't be resolved. The call to curl_easy_perform takes a while
(15 seconds or so), but I'm still not seeing calls to the progress callback.

Here's my code, (I removed the error handling and anything else that is not
libcurl related to make it clearer), and xprogress does not get called in
this case. It gets called when it gets to the http part though.

/*******************/

// make sure c-ares is used
curl_version_info_data* info= curl_version_info(CURLVERSION_NOW);
if(info->features&CURL_VERSION_ASYNCHDNS)
  std::cout << "ares enabled";
else
  std::cout << "ares NOT enabled";

// start here
curl_easy_setopt( _curl, CURLOPT_URL, url

// these two are optional (there are booleans that are tested)
    curl_easy_setopt( _curl, CURLOPT_SSL_VERIFYPEER, 0L)
    curl_easy_setopt( _curl, CURLOPT_SSL_VERIFYHOST, 0L)
                                                                          
curl_easy_setopt( _curl, CURLOPT_WRITEFUNCTION, responseCallback )
curl_easy_setopt( _curl, CURLOPT_FILE, (void *)&rs)
curl_easy_setopt( _curl, CURLOPT_NOPROGRESS, 0L)
curl_easy_setopt( _curl, CURLOPT_PROGRESSFUNCTION, xprogress)
curl_easy_setopt( _curl, CURLOPT_PROGRESSDATA, this)
curl_easy_setopt( _curl, CURLOPT_HTTPPOST, fp )
curl_easy_setopt( _curl, CURLOPT_PROXY, proxyServerAddress.c_str() )
curl_easy_setopt( _curl, CURLOPT_PROXYUSERNAME, proxyServerUserName )
curl_easy_setopt( _curl, CURLOPT_PROXYPASSWORD, proxyServerPassword )
curl_easy_setopt( _curl, CURLOPT_TIMEOUT, timeout )
curl_easy_setopt( _curl, CURLOPT_USERAGENT, "libcurl-agent/1.0")
curl_easy_perform( _curl ) )

Thanks for your help!

Adrian

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2010-01-01