curl has four timeouts; do not set just one
curl --max-time 10 in a script looks safe but only bounds total time. A connection silently dropped by a firewall stalls the full ten seconds even when three would do.
--connect-timeout 3bounds the TCP handshake.--max-time 10bounds the whole request.--speed-limitand--speed-timeabort a download that has slowed to nothing.- Setting both gives a fast failure when the handshake cannot complete.
curl -sS --connect-timeout 3 --max-time 10 --retry 2 --retry-delay 1 -o /dev/null -w '%{http_code} %{time_total}\n' https://example.com/
--retry covers connection errors and 5xx by default; --retry-all-errors widens it.