问题
I want to use function curl_easy_setopt(CURL *handle, CURLOPT_DNS_LOCAL_IP4, char *address)
, but when I download the source code,
./configure && make && make install
every fucntion is OK but this function curl_easy_setopt(CURL *handle, CURLOPT_DNS_LOCAL_IP4, char *address)
. This function explanation http://curl.haxx.se/libcurl/c/CURLOPT_DNS_LOCAL_IP4.html.AVAILABILITY says this option requires that libcurl was built with a resolver backend that supports this operation. The c-ares backend is the only such one. what does it mean? how I build libcurl with a resoluver backend.
thank you
回答1:
It means that you need to make sure that you build your libcurl to use c-ares for name resolving. This is because "normal" name resolver functions can't be told which servers to use (nor which source address to use when doing that communication), they use the ones you set in the system files.
c-ares is a separate library that does asynchronous DNS and name resolver calls that libcurl can be told to use.
来源:https://stackoverflow.com/questions/29738520/how-can-i-use-libcurl-function-curl-easy-setoptcurl-handle-curlopt-dns-local