From 28c5ddf13ac311d10bc4e8f9fc4ce0858a19b888 Mon Sep 17 00:00:00 2001 From: Stefan Eissing Date: Tue, 9 Apr 2024 09:41:19 +0200 Subject: [PATCH] tests: stabilitze test_02_23* - 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 | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/tests/http/clients/h2-download.c b/tests/http/clients/h2-download.c index 378ab97989..606eda3d5d 100644 --- a/tests/http/clients/h2-download.c +++ b/tests/http/clients/h2-download.c @@ -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"