curl / Mailing Lists / curl-library / Single Mail

curl-library

Re: Limit connection reuse to the first 120 seconds

From: Daniel Stenberg via curl-library <curl-library_at_cool.haxx.se>
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: https://httpd.apache.org/docs/2.4/mod/core.html (there's no mention
of what the default is)

The nginx document example shows it set the idle timeout to *75* seconds:
https://nginx.org/en/docs/http/ngx_http_core_module.html#keepalive_timeout
(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
this.

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

-- 
  / daniel.haxx.se
-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette:   https://curl.haxx.se/mail/etiquette.html
Received on 2019-04-18