Search code examples
proxydnstornadolibcurl

How can I tell if the libcurl installed has asynchronous DNS enabled?


I would like to try and use Tornado's proxying capabilities. For this, the documentation tells me, I need to have libcurl compiled with asynchronous DNS resolver.

I have a version of libcurl installed via yum (7.29), but I can't figure out how to tell whether it was built with asynchronous DNS resolution or not.

If it doesn't, is there a way to enable it, or do I have to build it from scratch? It seems like the latter is the only option I could find so far, hoping I missed something.

Thanks!


Solution

  • Call curl_version_info() and check the returned struct and its 'features' field:

       int features;             /* bitmask, see below */
    

    If that field has the bit CURL_VERSION_ASYNCHDNS set, you know this libcurl build resolves names asynchronously. Using either threads or it was built to use c-ares.

    If that bit is not set, it was built to use synchronous name resolves.