curl-library
Error 5
Date: Mon, 17 Mar 2008 08:41:36 -0400
Hi,
I posted a while ago, but what I thought was a fix apparently wasn't.
I'm still getting all kinds of ridiculous error 5's back when trying
to query hundreds of sites that are otherwise valid. I've tried this
on both OSX and Linux. I am wondering if it's got something to do with
C-Ares perhaps. I'm getting these errors back almost immediately, so
nothing is timing out.
Here is the code I'm using - if anyone has any ideas, please let me
know.
CURL *curl;
CURLcode res;
struct curl_slist *slist = NULL;
struct write_buffer buffer;
curl = curl_easy_init();
if (!curl) {
LOG(LOG_CRIT, ERR_CURL_INIT_FAIL, strerror(errno));
return EINVAL;
}
slist = curl_slist_append(slist,
"User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT
5.1; SV1)");
slist = curl_slist_append(slist, "Cache-Control: max-age=0");
slist = curl_slist_append(slist, "Accept-Language: en-
us,en;q=0.5");
slist = curl_slist_append(slist, "Accept-Encoding: ");
slist = curl_slist_append(slist,
"Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7");
slist = curl_slist_append(slist,
"Accept: text/xml,application/xml,application/xhtml+xml,text/
html;"
"q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5");
curl_easy_setopt(curl, CURLOPT_URL, url->url);
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0l);
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0l);
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1);
curl_easy_setopt(curl, CURLOPT_MAXREDIRS, 10l);
curl_easy_setopt(curl, CURLOPT_NOSIGNAL, 1l);
curl_easy_setopt(curl, CURLOPT_TCP_NODELAY, 1l);
curl_easy_setopt(curl, CURLOPT_AUTOREFERER, 1);
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, slist);
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_callback);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &buffer);
curl_easy_setopt(curl, CURLOPT_TIMEOUT, 60l);
curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT, 30l);
res = curl_easy_perform(curl);
Jonathan
Received on 2008-03-17