CURL parameter --max-time
includes --connect-timeout
to separate the timeout of the handshake phase.
CURL - Timeouts · Everything curl
In addition, CURL can distinguish timeout errors at different stages: "connection timeout" and "operation timeout".
For example, CURL command with 5 second connection timeout and 25 second maximum timeout setting:
$ curl -v --connect-timeout 5 -m 25 "https://yourname.com"
Connection timeout
curl: (28) Connection timed out after 5004 milliseconds
Operation timeout:
curl: (28) Operation timed out after 25005 milliseconds with 0 bytes received
Both timeout error codes are "28" and cannot be identified by code, but can be identified by message.