]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
tests: stabilitze test_02_23*
authorStefan Eissing <stefan@eissing.org>
Tue, 9 Apr 2024 07:41:19 +0000 (09:41 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Tue, 9 Apr 2024 11:27:21 +0000 (13:27 +0200)
- h2-download now always opens the output file on first write callback
  invocation, if it will pause the transfer or not.
- Checks on output files then does not depend on the amount of data curl
  has collected for the first write.

Closes #13323

tests/http/clients/h2-download.c

index 378ab979895df7ea3744416f7212de3e0891ae48..606eda3d5d81d666d0a1a74a42c1ac59be130bac 100644 (file)
@@ -119,14 +119,6 @@ static size_t my_write_cb(char *buf, size_t nitems, size_t buflen,
 
   fprintf(stderr, "[t-%d] RECV %ld bytes, total=%ld, pause_at=%ld\n",
           t->idx, (long)blen, (long)t->recv_size, (long)t->pause_at);
-  if(!t->resumed &&
-     t->recv_size < t->pause_at &&
-     ((t->recv_size + (curl_off_t)blen) >= t->pause_at)) {
-    fprintf(stderr, "[t-%d] PAUSE\n", t->idx);
-    t->paused = 1;
-    return CURL_WRITEFUNC_PAUSE;
-  }
-
   if(!t->out) {
     curl_msnprintf(t->filename, sizeof(t->filename)-1, "download_%u.data",
                    t->idx);
@@ -135,6 +127,14 @@ static size_t my_write_cb(char *buf, size_t nitems, size_t buflen,
       return 0;
   }
 
+  if(!t->resumed &&
+     t->recv_size < t->pause_at &&
+     ((t->recv_size + (curl_off_t)blen) >= t->pause_at)) {
+    fprintf(stderr, "[t-%d] PAUSE\n", t->idx);
+    t->paused = 1;
+    return CURL_WRITEFUNC_PAUSE;
+  }
+
   nwritten = fwrite(buf, nitems, buflen, t->out);
   if(nwritten < blen) {
     fprintf(stderr, "[t-%d] write failure\n", t->idx);
@@ -200,6 +200,7 @@ static void usage(const char *msg)
   fprintf(stderr,
     "usage: [options] url\n"
     "  download a url with following options:\n"
+    "  -a         abort paused transfer\n"
     "  -m number  max parallel downloads\n"
     "  -n number  total downloads\n"
     "  -A number  abort transfer after `number` response bytes\n"