]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
multi: do once-per-transfer inits in before_perform in DID state
authorDaniel Stenberg <daniel@haxx.se>
Mon, 22 Feb 2021 12:03:02 +0000 (13:03 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Mon, 22 Feb 2021 14:54:46 +0000 (15:54 +0100)
... since the state machine might go to RATELIMITING and then back to
PERFORMING doing once-per-transfer inits in that function is wrong and
it caused problems with receiving chunked HTTP and it set the
PRETRANSFER time much too often...

Regression from b68dc34af341805aeb7b3715 (shipped in 7.75.0)

Reported-by: Amaury Denoyelle
Fixes #6640
Closes #6641

lib/multi.c

index 2a8a2df96567f66ebefffc3ec3a29f96450c6481..9de3f40084fd2b2527728ee2af3806bf3cfc440c 100644 (file)
@@ -105,8 +105,8 @@ static const char * const statename[]={
 /* function pointer called once when switching TO a state */
 typedef void (*init_multistate_func)(struct Curl_easy *data);
 
-/* called when the PERFORM state starts  */
-static void init_perform(struct Curl_easy *data)
+/* called in DID state, before PERFORMING state */
+static void before_perform(struct Curl_easy *data)
 {
   data->req.chunk = FALSE;
   Curl_pgrsTime(data, TIMER_PRETRANSFER);
@@ -142,8 +142,8 @@ static void mstate(struct Curl_easy *data, CURLMstate state
     Curl_connect_free, /* DO */
     NULL,              /* DOING */
     NULL,              /* DOING_MORE */
-    NULL,              /* DID */
-    init_perform,      /* PERFORMING */
+    before_perform,    /* DID */
+    NULL,              /* PERFORMING */
     NULL,              /* RATELIMITING */
     NULL,              /* DONE */
     init_completed,    /* COMPLETED */