Sì.
Parametri di timeout
curlha due opzioni: --connect-timeoute --max-time.
Citando dalla manpage:
--connect-timeout <seconds>
Maximum time in seconds that you allow the connection to the
server to take. This only limits the connection phase, once
curl has connected this option is of no more use. Since 7.32.0,
this option accepts decimal values, but the actual timeout will
decrease in accuracy as the specified timeout increases in deci‐
mal precision. See also the -m, --max-time option.
If this option is used several times, the last one will be used.
e:
-m, --max-time <seconds>
Maximum time in seconds that you allow the whole operation to
take. This is useful for preventing your batch jobs from hang‐
ing for hours due to slow networks or links going down. Since
7.32.0, this option accepts decimal values, but the actual time‐
out will decrease in accuracy as the specified timeout increases
in decimal precision. See also the --connect-timeout option.
If this option is used several times, the last one will be used.
Defaults
Qui (su Debian) smette di provare a connettersi dopo 2 minuti, indipendentemente dal tempo specificato con --connect-timeoute sebbene il valore di timeout di connessione predefinito sia di 5 minuti secondo la DEFAULT_CONNECT_TIMEOUTmacro in lib / connect.h .
Un valore predefinito per --max-timenon sembra esistere, facendo curlattendere per sempre una risposta se la connessione iniziale ha esito positivo.
Cosa usare?
Probabilmente siete interessati a quest'ultima opzione, --max-time. Per il tuo caso, impostalo su 900(15 minuti).
Anche specificare un'opzione --connect-timeoutcome qualcosa 60(un minuto) potrebbe essere una buona idea. Altrimenti curlproverà a connettermi ancora e ancora, apparentemente usando un algoritmo di backoff.