Discussion:
curl -Z always exits 0
Jordan Geoghegan via curl-users
2021-04-13 01:38:56 UTC
Permalink
Hello,

I was hoping to get a sanity check here regarding semantics with the -Z/--parallel flag.

I'm using curl to download multiple files over HTTPS in a script, and I've found that no matter what, curl when invoked with -Z/--parallel always exits with a zero code. More specifically, it seems that the '--fail' and '--fail-early' flags have no effect when curl is invoked with -Z/--parallel:

$ curl --fail https://httpbin.org/status/404 || echo FAILED
curl: (22) The requested URL returned error: 404
FAILED

$ curl -Z --fail https://httpbin.org/status/404 || echo FAILED
curl: (22) The requested URL returned error: 404

$ curl --fail -s https://httpbin.org/status/404
$ echo $?                                                     
22
 
$ curl -Z --fail -s https://httpbin.org/status/404
$ echo $?                                         
0

Is this is a bug, or am I just holding it wrong?

My tests were run on an OpenBSD 6.8 machine with the following 'curl -V' output:

curl 7.72.0 (x86_64-unknown-openbsd6.8) libcurl/7.72.0 LibreSSL/3.2.2 zlib/1.2.3 nghttp2/1.41.0
Release-Date: 2020-08-19
Protocols: dict file ftp ftps gopher http https imap imaps pop3 pop3s rtsp smb smbs smtp smtps telnet tftp
Features: AsynchDNS HTTP2 HTTPS-proxy IPv6 Largefile libz NTLM NTLM_WB SSL UnixSockets

Any insight or advice would be greatly appreciated.

Regards,

Jordan



-----------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-users
Etiquette: h
Daniel Stenberg via curl-users
2021-04-13 05:49:47 UTC
Permalink
Post by Jordan Geoghegan via curl-users
$ curl -Z --fail -s https://httpbin.org/status/404
$ echo $?                                         
0
curl 7.72.0 (x86_64-unknown-openbsd6.8)
Thanks for your report!

I can reproduce with my 7.74.0 version. But when using my 7.76.0 I get:

$ curl -Z --fail -s https://httpbin.org/status/404
$ echo $?
22

I looked at the diff between these two versions and I *believe* this was fixed
mostly by accident with the introduction of --fail-with-body.
--
/ daniel.haxx.se
| Commercial curl support up to 24x7 is available!
| Private help, bug fixes, support, ports, new features
| https://www.wolfssl.com/contact/
Jordan Geoghegan via curl-users
2021-04-13 19:41:22 UTC
Permalink
Post by Daniel Stenberg via curl-users
Post by Jordan Geoghegan via curl-users
$ curl -Z --fail -s https://httpbin.org/status/404
$ echo $?                                         
0
curl 7.72.0 (x86_64-unknown-openbsd6.8)
Thanks for your report!
$ curl -Z --fail -s https://httpbin.org/status/404
$ echo $?
22
I looked at the diff between these two versions and I *believe* this was fixed mostly by accident with the introduction of --fail-with-body.
Hello,

Thank you for confirming that for me. It does appear to have been fixed with that commit. I'll just have to wait for 7.76 to make it's way into my OS's package repos.

Regards,

Jordan
-----------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-users
Etique

Ray Satiro via curl-users
2021-04-13 05:59:32 UTC
Permalink
Post by Jordan Geoghegan via curl-users
I was hoping to get a sanity check here regarding semantics with the -Z/--parallel flag.
$ curl --failhttps://httpbin.org/status/404 || echo FAILED
curl: (22) The requested URL returned error: 404
FAILED
$ curl -Z --failhttps://httpbin.org/status/404 || echo FAILED
curl: (22) The requested URL returned error: 404
$ curl --fail -shttps://httpbin.org/status/404
$ echo $?
22
$ curl -Z --fail -shttps://httpbin.org/status/404
$ echo $?
0
Is this is a bug, or am I just holding it wrong?
curl 7.72.0 (x86_64-unknown-openbsd6.8) libcurl/7.72.0 LibreSSL/3.2.2 zlib/1.2.3 nghttp2/1.41.0
Release-Date: 2020-08-19
Protocols: dict file ftp ftps gopher http https imap imaps pop3 pop3s rtsp smb smbs smtp smtps telnet tftp
Features: AsynchDNS HTTP2 HTTPS-proxy IPv6 Largefile libz NTLM NTLM_WB SSL UnixSockets
Any insight or advice would be greatly appreciated.
I can't reproduce. I'd guess it was fixed by 8a964cb [1] (precedes
curl-7_76_0).

[1]: https://github.com/curl/curl/commit/8a964cb

-----------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-users
Etiquette: https://curl.haxx.se/mail/etiqu
Loading...