]> granicus.if.org Git - curl/commitdiff
multi: set the EXPIRE_*TIMEOUT timers at TIMER_STARTSINGLE time
authorDaniel Stenberg <daniel@haxx.se>
Sun, 27 Jan 2019 22:45:42 +0000 (23:45 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Fri, 1 Feb 2019 07:19:40 +0000 (08:19 +0100)
To make sure Curl_timeleft() also thinks the timeout has been reached
when one of the EXPIRE_*TIMEOUTs expires.

Bug: https://curl.haxx.se/mail/lib-2019-01/0073.html
Reported-by: Zhao Yisha
Closes #3501

lib/multi.c
lib/transfer.c

index 75ece15caa1d975f9295895bb4fb292679c9ebfa..130226f56194fa78a7447b2a1bee6e6bacf7eda9 100644 (file)
@@ -1454,6 +1454,12 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi,
     case CURLM_STATE_CONNECT:
       /* Connect. We want to get a connection identifier filled in. */
       Curl_pgrsTime(data, TIMER_STARTSINGLE);
+      if(data->set.timeout)
+        Curl_expire(data, data->set.timeout, EXPIRE_TIMEOUT);
+
+      if(data->set.connecttimeout)
+        Curl_expire(data, data->set.connecttimeout, EXPIRE_CONNECTTIMEOUT);
+
       result = Curl_connect(data, &async, &protocol_connect);
       if(CURLE_NO_CONNECTION_AVAILABLE == result) {
         /* There was no connection available. We will go to the pending
index e687e6018a68b09214abf407309a7829577d7b82..3a18c7bdd0d8e8cf5035f3d13598f94d73835552 100644 (file)
@@ -1558,12 +1558,6 @@ CURLcode Curl_pretransfer(struct Curl_easy *data)
     Curl_pgrsResetTransferSizes(data);
     Curl_pgrsStartNow(data);
 
-    if(data->set.timeout)
-      Curl_expire(data, data->set.timeout, EXPIRE_TIMEOUT);
-
-    if(data->set.connecttimeout)
-      Curl_expire(data, data->set.connecttimeout, EXPIRE_CONNECTTIMEOUT);
-
     /* In case the handle is re-used and an authentication method was picked
        in the session we need to make sure we only use the one(s) we now
        consider to be fine */