cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: http response codes in curl.h

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Wed, 10 Nov 2010 08:52:53 +0100 (CET)

On Wed, 10 Nov 2010, Vasyl' wrote:

> I wonder if there is a reason why curl.h has no HTTP response codes defines
> like
>
> #define HTTP_STATUS_NOT_FOUND 404

Yes, there is a reason.

libcurl defines its own headers and numbers for apps to use, things that are
defined and used by libcurl. Numbers that are defined and controlled
*elsewhere* are not curl's problem and therefor aren't defined by curl.

Also, 404 is a return code defined in the HTTP spec to have a meaning. I think
many people already know what it means. It might even be so that
HTTP_STATUS_NOT_FOUND would be less meaningful than 404 to many of them.

> Ive meat several examples using 404 constant in source code but I think it
> would be better to have define.

I quite agree in general about numerical constants in code, but I am not
convinced when it regards numerical constants in code that are defined in
protocol standards. IMHO.

-- 
  / daniel.haxx.se
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2010-11-10