cURL / Mailing Lists / curl-library / Single Mail

curl-library

Async cancel lengthy DNS lookup

From: Adrian Michel <adrian_at_amichel.com>
Date: Wed, 30 Dec 2009 17:22:07 -0800

Hi everybody,
 
I use libcurl with OpenSSL on Windows, mainly for http and https in several
multi-threaded GUI apps, and most things work perfectly.
 
I implemented async cancel functionality by using the progress callback, but
that doesn't seem to work during the DNS lookup phase. I tested with a
domain name that doesn't resolve and I don't get any progress callback calls
and have to wait until the curl_easy_perform returns with a failure result,
which can take a while. This is unfortunate as since these are GUI apps, the
user commands, including that to cancel a lengthy http request, must be very
responsive.
 
Is there any simple way to implement the async cancel in this case - by
using another callback for example?
 
I saw that c-ares can be used for async dns lookup, but I'd rather not add
yet another dependency to all the projects I already maintain. Besides, I
couldn't find any info in the libcurl documentation on how to actually add
c-ares support. I found this line in CMakeList.txt:
 
option(CURL_USE_ARES "Set to ON to enable c-ares support" OFF)
 
but I couldn't find any references to such as #ifdef CURL_USE_ARES in the
libcurl source code.
 
Please note that I use Visual Studio 2003 (v 7.1).
 
BTW, I sent a link to be inserted in your directory of libcurl powered apps
a while ago, but it was never listed. Are there any special requirements for
that?
 
Thanks,
 
Adrian

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