cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Errors and error mapping to http unclear

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Fri, 4 Dec 2009 12:48:40 +0100 (CET)

On Fri, 4 Dec 2009, vick wrote:

> With HTTP/HTTPS connections, the error from curl mapping is unclear.
> curl_easy_perform is synchronous and does not return and prevents you from
> asynchronous flexibility that is available in, say, winhttp.

Right, so use the asynchronous multi interface instead, or run the
easy_perform in a separate thread. It's your choice.

> When it returns, how can i tell what is the mapping from/to the HTTP
> errors (eg 401), unauthorized, etc.

In HTTP(S) land we don't consider a successful HTTP transfer an error. If
a HTTP response contains a 404, 401 or 407 or whatever that is still not an
error in libcurl. libcurl may still successfully have transfered the 404.

If you want to extract the server response code, you use curl_easy_getinfo()
after a successful transfer.

-- 
  / daniel.haxx.se
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2009-12-04