tool_operate: Fix --fail-early with parallel transfers

- Abort via progress callback to fail early during parallel transfers.

When a critical error occurs during a transfer (eg --fail-early
constraint) then other running transfers will be aborted via progress
callback and finish with error CURLE_ABORTED_BY_CALLBACK (42). In this
case, the callback error does not become the most recent error and a
custom error message is used for those transfers:

curld --fail --fail-early --parallel
https://httpbin.org/status/404 https://httpbin.org/delay/10

curl: (22) The requested URL returned error: 404
curl: (42) Transfer aborted due to critical error in another transfer

> echo %ERRORLEVEL%
22

Fixes https://github.com/curl/curl/issues/6939
Closes https://github.com/curl/curl/pull/6984
This commit is contained in:
Jay Satiro 2021-04-29 17:06:49 -04:00
parent 1828f6ae2e
commit b654fb4cd3
3 changed files with 43 additions and 1 deletions

View file

@ -56,6 +56,9 @@ struct per_transfer {
time_t startat; /* when doing parallel transfers, this is a retry transfer
that has been set to sleep until this time before it
should get started (again) */
bool abort; /* when doing parallel transfers and this is TRUE then a critical
error (eg --fail-early) has occurred in another transfer and
this transfer will be aborted in the progress callback */
/* for parallel progress bar */
curl_off_t dltotal;