curl / Mailing Lists / curl-library / Single Mail
Buy commercial curl support from WolfSSL. We help you work out your issues, debug your libcurl applications, use the API, port to new platforms, add new features and more. With a team lead by the curl founder himself.

Setting connection timeout per host?

From: Midnight Wonderer via curl-library <>
Date: Sat, 9 Jan 2021 11:56:17 +0700


Regarding CURLOPT_CONNECTTIMEOUT_MS option, I found out that the
timeout set is shared between multiple hosts. Not only that, the
allotment is weird, IMO.

The period set will be split into multiple time budgets for each
connection in reverse exponential manners. See the following thread
for the details.

To recap, I'll produce a short example here:
If you set the connection timeout to 3 seconds, the first server gets
1.5s budget; the second one gets 750ms, the third 375ms, and so on.

Don't get me wrong; I think splitting into [timeout]/N is equally
weird too. What I actually expect from the connection timeout is: it
should be applied per connection. For instance, if I set the timeout
to 1s, I expect connection timeouts of 1s for each try. This is also
the behavior of Nginx when used as a reverse proxy.

Is there a way to accomplish this with libcurl?
Received on 2021-01-09