curl / Mailing Lists / curl-users / Single Mail
Buy commercial curl support from WolfSSL. We help you work out your issues, debug your libcurl applications, use the API, port to new platforms, add new features and more. With a team lead by the curl founder himself.

Which transfer failed in case of multiple transfers?

From: Ilya Basin via curl-users <>
Date: Thu, 4 Feb 2021 12:43:48 +0300

Hi List.
I'm downloading many files from a site. To reuse the connection I invoke curl with multiple URLs and use --write-out '%{http_code}' to check whether all codes were 200.
If in the middle of the downloads the connection is lost curl writes the error message to stderr, but still prints 200 to stdout and exits with 0.
There's no --write-out '%{error_code}' or something like that. How to check which transfers failed an re-download only them?

The only workaround I can think of is to add --fail-early, check the exit code and count the number of the downloaded files.
Received on 2021-02-04