cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: error handling in non-html transfer

From: Lars Nilsson <chamaeleon_at_gmail.com>
Date: Fri, 22 Mar 2013 18:39:17 -0400

On Fri, Mar 22, 2013 at 11:26 AM, Adam Kellas <adam.kellas_at_gmail.com> wrote:
> When things go well the right data ends up in "bar", but if it fails curl
> still exits with 0 leaving something like "500 Internal Server Error" in it.
> Is there a way the server can tell curl, or any http client, to print the
> body to stderr and exit nonzero? To be clear, I'm hoping to be able to use
> the curl program as my client side but if I need to write a custom client
> that could be done too. I've thought about adding a custom header like
> X-ErrorMessage but don't know if curl could process that.

You could experiment with the -f and -w options.

Lars Nilsson
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-users
FAQ: http://curl.haxx.se/docs/faq.html
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2013-03-22