cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Curl_retry_request

From: Kevin Baughman <curb_pks_at_yahoo.com>
Date: Fri, 18 Dec 2009 07:15:17 -0800 (PST)

>First, why would you want to disable retrying a request? This only
>happens when you've told curl that it's okay to re-use connections. To
>be in this code, you tried to re-use a connection but failed. Are you
>saying that you want your code to always use a new connection, or to
>give up entirely if it cannot re-use a connection?

The main reason is that I have a request that can not be received by
the server twice. Regardless of how much data is transferred. Does the logic below take into account if the "PUT" itself was received? So yes, try to reuse the connection, and fail if it can't be reused would fix this case.

>Second, there's already a way to disable connection re-use. The third
>line of this conditional, "conn->bits.reuse" checks whether re-use is
>enabled or not. You can already configure this with CURLOPT_FORBID_REUSE.

I want to reuse connections, just want our application retry logic to
handle the case where an empty reply is received (this is the other messgae message I see when the retry logic triggers).

~Kevin

________________________________
From: "johansen_at_sun.com" <johansen_at_sun.com>
To: libcurl development <curl-library_at_cool.haxx.se>
Sent: Thu, December 17, 2009 4:34:52 PM
Subject: Re: Curl_retry_request

On Wed, Dec 16, 2009 at 11:28:26AM -0800, Kevin Baughman wrote:
> I have an application that is occasionally seeing this debug message:
>
> * SSL read: errno -5961
> * Connection died, retrying a fresh connect
> * Closing connection #1
>
> I noticed in the function Curl_retry_request() there seems to be no
> way to disable this behavior. Is there any kind of option that will
> disable ever retrying the request under these circumstances?
>
> if((data->req.bytecount +
> data->req.headerbytecount == 0) &&
> conn->bits.reuse &&
> !data->set.opt_no_body) {
> /* We got no data, we attempted to re-use a connection and yet we want a
> "body". This might happen if the connection was left alive when we were
> done using it before, but that was closed when we wanted to read from
> it again. Bad luck. Retry the same request on a fresh connect! */
> infof(conn->data, "Connection died, retrying a fresh connect\n");
> *url = strdup(conn->data->change.url);
>
> conn->bits.close = TRUE; /* close this connection */
> conn->bits.retry = TRUE; /* mark this as a connection we're about
> to retry. Marking it this way should
> prevent i.e HTTP transfers to return
> error just because nothing has been
> transfered! */
> retry = TRUE;
> }
>
> I can add a user defined option for this, but wanted to make sure I
> was correct in saying there is no way to disable this.

First, why would you want to disable retrying a request? This only
happens when you've told curl that it's okay to re-use connections. To
be in this code, you tried to re-use a connection but failed. Are you
saying that you want your code to always use a new connection, or to
give up entirely if it cannot re-use a connection?

Second, there's already a way to disable connection re-use. The third
line of this conditional, "conn->bits.reuse" checks whether re-use is
enabled or not. You can already configure this with CURLOPT_FORBID_REUSE.

What problem are you trying to solve, exactly?

-j
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html

      

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2009-12-18