cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Which functions must be re-set after curl_easy_perform ()

From: Dan Fandrich <dan_at_coneharvesters.com>
Date: Fri, 4 Mar 2011 16:08:30 -0800

On Fri, Mar 04, 2011 at 06:21:12PM -0500, richardcavell_at_mail.com wrote:
> Now, if curl_easy_perform fails due to certain recoverable errors
> (HTTP 503, Wikipedia is lagging, etc) I call curl_easy_perform up to
> 9 more times, sleeping for 60 seconds in between each call. Yet, if
> the first call fails, the next 9 times invariably each fail within a
> fraction of a second. I think it's because one or more of the setup
> functions need to be called again.

How do they fail? With the same error code or not? It might be something
to do with DNS, in which case retrying longer would help. It could also be
that you hit a busy server, and since libcurl will attempt to keep open the
HTTP connection, the next request will hit exactly the same server which
has exactly the same problem. If your app closes the connection first,
then the next request could go to another server (due to round-robin DNS
or load balancing) and it is more likely to succeed. You can install a
debugging callback to retrieve the data that libcurl is sending to the
server to make sure it's what you expect.

>>> Dan
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2011-03-05