To those arguing whether CURLOPT_TIMEOUT
includes CURLOPT_CONNECTTIMEOUT
or not; I'll remind you that libcurl supports more than 23 different OSes, including DOS.
Internet connections are incredibly complex (proxies, DNS resolution, IP connect, IP accept, SSH/SSL handshake, actual data transmission over a specific protocol like HTTP) and it may not always be possible for libcurl to honour exactly the timeouts requested.
The rule of thumbs is that you should set CURLOPT_TIMEOUT
>= CURLOPT_CONNECTTIMEOUT
because that's what the manual says and libcurl will try to honour. Often with extreme accuracy.
But on some platforms or edge cases you can easily run into situations where the actual timeout was CURLOPT_TIMEOUT
+ CURLOPT_CONNECTTIMEOUT
; or heck, I even ran into situations where all timeouts are ignored because for a specific step in the connection process the OS/framework involved doesn't ask for a timeout value and won't return control to libcurl; and that's something beyond libcurl's control.