]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
hyper: fix a progress upload counter bug
authorNicholas Nethercote <n.nethercote@gmail.com>
Fri, 1 Sep 2023 04:55:47 +0000 (14:55 +1000)
committerDaniel Stenberg <daniel@haxx.se>
Fri, 1 Sep 2023 12:44:12 +0000 (14:44 +0200)
`Curl_pgrsSetUploadCounter` should be a passed a total count, not an
increment.

This changes the failing diff for test 579 with hyper from this:
```
 Progress callback called with UL 0 out of 0[LF]
-Progress callback called with UL 8 out of 0[LF]
-Progress callback called with UL 16 out of 0[LF]
-Progress callback called with UL 26 out of 0[LF]
-Progress callback called with UL 61 out of 0[LF]
-Progress callback called with UL 66 out of 0[LF]
+Progress callback called with UL 29 out of 0[LF]
```
to this:
```
 Progress callback called with UL 0 out of 0[LF]
-Progress callback called with UL 8 out of 0[LF]
-Progress callback called with UL 16 out of 0[LF]
-Progress callback called with UL 26 out of 0[LF]
-Progress callback called with UL 61 out of 0[LF]
-Progress callback called with UL 66 out of 0[LF]
+Progress callback called with UL 40 out of 0[LF]
```
Presumably a step in the right direction.

Closes #11780

lib/c-hyper.c

index f0f49ce6c20d858ea15866ab2ae7095f66852f0b..05080fa9ac838c13c91bb293214808be2c6ea9cf 100644 (file)
@@ -771,7 +771,7 @@ static int uploadstreamed(void *userdata, hyper_context *ctx,
     /* increasing the writebytecount here is a little premature but we
        don't know exactly when the body is sent */
     data->req.writebytecount += fillcount;
-    Curl_pgrsSetUploadCounter(data, fillcount);
+    Curl_pgrsSetUploadCounter(data, data->req.writebytecount);
   }
   return HYPER_POLL_READY;
 }