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

@ -101,6 +101,9 @@ int xferinfo_cb(void *clientp,
per->ultotal = ultotal;
per->ulnow = ulnow;
if(per->abort)
return 1;
if(config->readbusy) {
config->readbusy = FALSE;
curl_easy_pause(per->curl, CURLPAUSE_CONT);