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: curl with bash and proper error handling
- Contemporary messages sorted: [ by date ] [ by thread ] [ by subject ] [ by author ] [ by messages with attachments ]
From: Siegfried Kiermayer via curl-users <curl-users_at_cool.haxx.se>
Date: Mon, 16 Nov 2020 19:46:15 +0100
Hi rainer,
so it would work by telling curl to write the output to a file and
everything else to stderr?
Sounds duable, but still quite weird.
If the existing -f flag would be more flexible or would fail on non
2xx, that would feel way more natural.
How can i find out why -f isn't fail-safe?
Tx,
Sigi
On Fri, 6 Nov 2020 at 13:35, Rainer Canavan via curl-users
<curl-users_at_cool.haxx.se> wrote:
>
> [...]
> > I just want to get the content of a http request and the status code.
> > The content to either use it directly or to make it visible in a way
> > that I'm able to see the issue when my curl command fails inside my
> > script.
>
> you can use -o to write the response body to a file or -w with
> %{stderr} and %{http_code} to write the http status code to stderr
> instead of stdout.
>
> > 3. Could curl return the first number as a sub status code? Like 1,2,3,4 or 5?
>
> use sed or similar tools to extract just the first digit. It doesn't
> make sense to build something like this into curl if other tools can
> do the job much better already.
>
> rainer
> -----------------------------------------------------------
> Unsubscribe: https://cool.haxx.se/list/listinfo/curl-users
> Etiquette: https://curl.haxx.se/mail/etiquette.html
-----------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-users
Etiquette: https://curl.haxx.se/mail/etiquette.html
Received on 2020-11-16
Date: Mon, 16 Nov 2020 19:46:15 +0100
Hi rainer,
so it would work by telling curl to write the output to a file and
everything else to stderr?
Sounds duable, but still quite weird.
If the existing -f flag would be more flexible or would fail on non
2xx, that would feel way more natural.
How can i find out why -f isn't fail-safe?
Tx,
Sigi
On Fri, 6 Nov 2020 at 13:35, Rainer Canavan via curl-users
<curl-users_at_cool.haxx.se> wrote:
>
> [...]
> > I just want to get the content of a http request and the status code.
> > The content to either use it directly or to make it visible in a way
> > that I'm able to see the issue when my curl command fails inside my
> > script.
>
> you can use -o to write the response body to a file or -w with
> %{stderr} and %{http_code} to write the http status code to stderr
> instead of stdout.
>
> > 3. Could curl return the first number as a sub status code? Like 1,2,3,4 or 5?
>
> use sed or similar tools to extract just the first digit. It doesn't
> make sense to build something like this into curl if other tools can
> do the job much better already.
>
> rainer
> -----------------------------------------------------------
> Unsubscribe: https://cool.haxx.se/list/listinfo/curl-users
> Etiquette: https://curl.haxx.se/mail/etiquette.html
-----------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-users
Etiquette: https://curl.haxx.se/mail/etiquette.html
Received on 2020-11-16