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
This commit is contained in:
Stefan Eissing 2024-04-09 09:41:19 +02:00 committed by Daniel Stenberg
parent e7de80e8ce
commit 28c5ddf13a
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2

View 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"