From 2a52c4b7a954a174440148a35e3ec52ef3689616 Mon Sep 17 00:00:00 2001 From: ithewei Date: Mon, 12 Oct 2026 20:33:25 +0800 Subject: [PATCH] fix(http): honor HttpClient connect_timeout above 10s http_client_connect started blocktime at DEFAULT_CONNECT_TIMEOUT (10s) and only ever lowered it with MIN(), so a connect_timeout above 10s was silently capped. The same budget also covers the HTTP CONNECT tunnel and the TLS handshake. Use connect_timeout as-is, falling back to the default only when it is unset, and cap it by the total timeout only when one is set. Co-authored-by: Cursor --- http/client/HttpClient.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/http/client/HttpClient.cpp b/http/client/HttpClient.cpp index 6bb90146a..eff80957b 100644 --- a/http/client/HttpClient.cpp +++ b/http/client/HttpClient.cpp @@ -367,10 +367,9 @@ int http_client_connect(http_client_t* cli, HttpRequest* req) { req->ParseUrl(); } cli->Close(); - int blocktime = DEFAULT_CONNECT_TIMEOUT; - int timeout = MIN(req->connect_timeout, req->timeout); - if (timeout > 0) { - blocktime = MIN(timeout*1000, blocktime); + int blocktime = req->connect_timeout > 0 ? req->connect_timeout * 1000 : DEFAULT_CONNECT_TIMEOUT; + if (req->timeout > 0) { + blocktime = MIN(blocktime, req->timeout * 1000); } bool tunnel = req->IsTunnelProxy();