cURL / Mailing Lists / curl-library / Single Mail

curl-library

libcurl custom dns not failing (when bad dns ip configured with CURLOPT_DNS_SERVERS )

From: Stefan Rogin <stefan.rogin2000_at_gmail.com>
Date: Mon, 25 Nov 2013 15:04:33 +0200

Hello,

I've made a multithreaded (pthread) c++ program that is configured to use
a list of custom dns.
In my tests I've used google's 8.8.8.8 for good ex, and some random ip like
113.65.123.138, 13.23.123.87 to test fail. But all goes the same in both
cases, successfully.

Curl was built with C-ares support, and I've tested just to be sure:
curl_version_info_data *data = curl_version_info(CURLVERSION_NOW);
 cout<<endl<<"Curl version: "<< data->version <<endl
<<"AsyncDNS: "<<( data->features | CURL_VERSION_ASYNCHDNS ? "YES" : "NO" )
<<endl;
 //output: Curl version: 7.30.0 \n AsyncDNS: YES
The rest of the code:
 curl_easy_setopt(curl, CURLOPT_DNS_SERVERS,
thisThreadData->current_dns->dns_str.c_str());
 curl_easy_setopt(curl, CURLOPT_DNS_USE_GLOBAL_CACHE,false); //thread safety
 curl_easy_setopt(curl, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);
 curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT, CONNECT_TIMEOUT);
 curl_easy_setopt(curl, CURLOPT_TIMEOUT, CONNECTION_TIMEOUT);
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, true);
 curl_easy_setopt(curl, CURLOPT_FAILONERROR, 1);
curl_easy_setopt(curl, CURLOPT_MAXREDIRS, 5);
 curl_easy_setopt(curl, CURLOPT_NOSIGNAL, 1);
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, curl_to_string);
 curl_easy_setopt(curl, CURLOPT_WRITEHEADER, &getUrlOutput->header);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &getUrlOutput->html);
 curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, false);
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, false);
 curl_easy_setopt(curl, CURLOPT_ACCEPT_ENCODING, "gzip,deflate");
 status=curl_easy_perform(curl);

I've tested the random IPs (just in case I've stumbled on some valid DNS) :
$ host google.com 113.65.123.138
;; connection timed out; no servers could be reached
$ host google.com 13.23.123.87
;; connection timed out; no servers could be reached

What am I missing ?

Thank you

-- 
*Stefan Rogin*
Web designer & developer, Software Developer, Data Analyst

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