CURLOPT_CONNECTTIMEOUT is not a segment of the time represented by CURLOPT_TIMEOUT
If CURLOPT_CONNECTTIMEOUT is set to 3 seconds and CURLOPT_TIMEOUT to 4 seconds, execution may take up to 7 seconds.
I tested this by simulating slow server connecting (iptables drop).