ngtcp2: handshake timeout should be equal to --connect-timeout

Default timeout is hardcoded (10 seconds) and doesn't respect
--connect-timeout parameter. In some cases 10 seconds can be not enough
or too long to "establish a connection". Moreover the non-working
--connect-timeout parameter for http3 is confusing. This change makes
the handshake timeout equal to --connect-timeout, if it's set.
Discussion is here https://github.com/curl/curl/discussions/18427

Closes #18431
This commit is contained in:
XCas13 2025-08-29 13:52:25 +04:00 committed by Daniel Stenberg
parent 5bb49a485c
commit 21c288902d
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2

View file

@ -431,9 +431,9 @@ static void quic_settings(struct cf_ngtcp2_ctx *ctx,
s->log_printf = NULL;
#endif
(void)data;
s->initial_ts = pktx->ts;
s->handshake_timeout = QUIC_HANDSHAKE_TIMEOUT;
s->handshake_timeout = (data->set.connecttimeout > 0) ?
data->set.connecttimeout * NGTCP2_MILLISECONDS : QUIC_HANDSHAKE_TIMEOUT;
s->max_window = 100 * ctx->max_stream_window;
s->max_stream_window = 10 * ctx->max_stream_window;