cURL / Mailing Lists / curl-library / Single Mail


Re: libcurl - Avoiding 'retrying a fresh connect'

From: Dan Fandrich <>
Date: Thu, 17 Apr 2008 11:37:06 -0700

On Thu, Apr 17, 2008 at 02:20:57PM -0400, Scott Rallya wrote:
> I'm having an issue with libcurl where when a connection to a backend server
> terminates unexpectedly, curl tries to reissue a request to the same hostname
> and port. I understand that this is usually desired behavior, however, in the
> context of how I'm using the libcurl library its something that remains
> undesired. If such an issue occurs, I require that libcurl not try to re-issue
> the request to the same hostname and port (since I maintain a list of other
> servers to connect to.) I was wondering if there was any way to disable this
> behavior in libcurl?

I don't think libcurl lets you disable it, but you could probably short-
circuit it by checking the socket from within your app. Before issuing the
new request, use the CURLINFO_LASTSOCKET curl_easy_getinfo option to
get the socket that was last used and check if it's still open yourself,
then issue the request accordingly.

>>> Dan

--              The web change of address service
          Let webmasters know that your web site has moved
Received on 2008-04-17