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.

Re: Printing the URL in the error messages when --fail is passed?

From: Timothe Litt <litt_at_acm.org>
Date: Sun, 24 Jul 2022 13:52:57 -0400

Inline

On 24-Jul-22 13:44, Paul Gilmartin via curl-users wrote:
> On 7/24/22 10:07:44, Timothe Litt via curl-users wrote:
>>     ...
>> But the current behavior is analogous to
>>
>> cp z* x* foo/
>>
>> returning 'file not found' instead of "cp: cannot stat 'x*': No such
>> file or directory".
>>
> Would it be better to send such messages to stderr, as "cp" does,
> rather than to stdout?
>
Yes, if there is one.  curl already does this.

$ curl --fail --parallel https://curl.se/nothing-404
https://curl.se/nothing-404-2 2>zl.txt

$ cat zl.txt
curl: (22) The requested URL returned error: 404
curl: (22) The requested URL returned error: 404

--write-out has %{stderr}  W


> Optionally? (-w=/dev/fd/2?)
>
> What if the OS has no "stderr"?  (I know one that hasn't.)
>
Then it's not POSIX & I wonder how curl works, but the port must use
stdout or equivalent.

Timothe Litt
ACM Distinguished Engineer
--------------------------
This communication may not represent the ACM or my employer's views,
if any, on the matters discussed.


-- 
Unsubscribe: https://lists.haxx.se/listinfo/curl-users
Etiquette:   https://curl.se/mail/etiquette.html
Received on 2022-07-24