]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
connect: for CONNECT_ONLY, CURLOPT_TIMEOUT does not apply
authorDaniel Stenberg <daniel@haxx.se>
Thu, 23 Oct 2025 14:20:01 +0000 (16:20 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Thu, 23 Oct 2025 20:53:15 +0000 (22:53 +0200)
Since using CONNECT_ONLY is by defintion only a connect, we make the
timeleft function return 0 after the connection is done so that it does
not - surprisingly - timeout later.

Fixes #18991
Reported-by: Pavel P
Closes #19204

lib/connect.c
lib/pingpong.c

index 5dc4e2fc747b6fca9bf6c9b044c02864053d15e0..e3295524b0ec63d937ec0c030311da3f02840e73 100644 (file)
@@ -123,7 +123,7 @@ timediff_t Curl_timeleft(struct Curl_easy *data,
      before the connect timeout expires and we must acknowledge whichever
      timeout that is reached first. The total timeout is set per entire
      operation, while the connect timeout is set per connect. */
-  if(data->set.timeout <= 0 && !duringconnect)
+  if((!data->set.timeout || data->set.connect_only) && !duringconnect)
     return 0; /* no timeout in place or checked, return "no limit" */
 
   if(!nowp) {
@@ -131,9 +131,9 @@ timediff_t Curl_timeleft(struct Curl_easy *data,
     nowp = &now;
   }
 
-  if(data->set.timeout > 0) {
+  if(data->set.timeout) {
     timeleft_ms = data->set.timeout -
-                  curlx_timediff(*nowp, data->progress.t_startop);
+      curlx_timediff(*nowp, data->progress.t_startop);
     if(!timeleft_ms)
       timeleft_ms = -1; /* 0 is "no limit", fake 1 ms expiry */
     if(!duringconnect)
index 3f6da71eae2c4afa0694ec331111c9aba87e36c5..0a15e33f0a3186840b4e960bf8a465476ac23b92 100644 (file)
@@ -64,7 +64,7 @@ timediff_t Curl_pp_state_timeout(struct Curl_easy *data,
      full response to arrive before we bail out */
   timeout_ms = response_time - curlx_timediff(now, pp->response);
 
-  if((data->set.timeout > 0) && !disconnecting) {
+  if(data->set.timeout && !disconnecting) {
     /* if timeout is requested, find out how much overall remains */
     timediff_t timeout2_ms = Curl_timeleft(data, &now, FALSE);
     /* pick the lowest number */