curl / Mailing Lists / curl-library / Single Mail



From: Weixi Li via curl-library <>
Date: Wed, 10 Apr 2019 12:07:45 +0000

From: Daniel Stenberg <>
Sent: Wednesday, April 10, 2019 4:03 AM
To: Weixi Li via curl-library
Cc: Weixi Li

>The default 300 seconds was just arbitratrily picked at some point in time to
>be very conservative but still at least give up at some point.
>It is certinly safe to reduce the timeout to whatever value you think is fine.
>You know your conditions and how long you're willing to wait for curl to try.
>Having it set too low will only risk you canceling a connecton that could have
>connected fine if you gave it more time.
>Most systems will resend lost TCP SYN packets a few times with an exponential
>backoff and in 30 seconds not all have finished retrying. But the connect
>phase in curl also includes name resolving and TLS handshake etc so a slow
>network with packet loss could at least in theory take a long time to connect.
>In reality I doubt you see very many connects taking more than just a few
>seconds .

Thank you very much for the comments. We did notice an interesting case: for an SFTP connection via IP, the Squid proxy would do a reverse DNS lookup which would require 30 seconds to fail eventually. So it's probably unsafe to set the connection timeout too low.

Received on 2019-04-10