cURL / Mailing Lists / curl-library / Single Mail


What clear up required after previous errors ?

From: Lyndon Hill <>
Date: Sat, 21 Feb 2009 06:20:36 +0000 (GMT)


I am using the multi interface to get files via HTTP. In my app you can set the proxy. I noticed the following problem:

1. I forget to set the proxy
2. curl says "name lookup timed out, couldn't resolve host ..."
3. I set the proxy
4. curl cannot resolve the host "proxy..."

If I remember to set the proxy then the code works fine.

I do a multi_init at the start up of my code and just add and remove easy handles when I need to get files. At the end of getting a file I do a multi_remove and an easy_cleanup on the easy handle.

I'm beginning to think that every time the multi stack is empty I should completely throw it away with a multi_cleanup and start a new one next time with a multi_init. Is that right ?

It just seems a bit weird that a new easy handle with proxy specified doesn't try to use it.

These are my easy opts:
  curl_easy_setopt(handle, CURLOPT_URL, url);
  curl_easy_setopt(handle, CURLOPT_VERBOSE, 1);
  curl_easy_setopt(handle, CURLOPT_TIMEOUT, timeout);
  curl_easy_setopt(handle, CURLOPT_PROXY, proxy);
  curl_easy_setopt(handle, CURLOPT_WRITEFUNCTION, writeData);
  curl_easy_setopt(handle, CURLOPT_WRITEDATA, (void *)&chunk);
  curl_easy_setopt(handle, CURLOPT_FOLLOWLOCATION, 1);

I'm using the latest libcurl.


Received on 2009-02-21