curl / Mailing Lists / curl-library / Single Mail


Re: Limit connection reuse to the first 120 seconds

From: Daniel Stenberg via curl-library <>
Date: Thu, 18 Apr 2019 09:11:11 +0200 (CEST)

On Wed, 17 Apr 2019, Rainer Canavan via curl-library wrote:

> In our use of curl, the most annoying problem with no-reusable connections
> is if there's basically a race condition between the server closing the
> connection and the client "successfully" sending a non-retryable / unsafe
> request, such as a http POST. This could still happen if the server has a
> timeout of 120s, therefore I would suggest a slightly shorter timeout, for
> example 118s.

Sure, but is exactly 120 seconds really a "typical" or especially common
server timeout value then? I just picked this value out of thin air,
completely arbitrarily. We could just as well make the default 58, 122 or 179

The Apache httpd document example shows it set the idle timeout to *5*
seconds: (there's no mention
of what the default is)

The nginx document example shows it set the idle timeout to *75* seconds:
(while mentioning that IE closes connections after "about 60 seconds", but
also not stating what the default value is)

> I would advocate for a configuration option to set the specific timeout

Thank you everyone for your feedback. It was made clear to me that we need

I've updated my PR with a new option to set it: CURLOPT_MAXAGE_CONN

Received on 2019-04-18