cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: idiot-proofing getinfo

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Fri, 22 Dec 2006 14:42:17 +0100 (CET)

On Fri, 22 Dec 2006, David McCreedy wrote:

> I don't know what the forum's philosophy is on these types of safety checks.
> Should we implement a check or let the caller pay the price for their coding
> errors?

I think simple and cheap checks can be added since we know people will throw
all sorts of bad inputs on the API and then blame the library stubbornly,
making us spend time on such issues.

> My patch (attached and below) tries to make getinfo at least
> idiot-resistant, in case the decision is to add the check.

I'd rather always just check for data being NULL and return error if so. I
mean, just because CURLINFO_SSL_ENGINES currently survices with such an error
we shouldn't encourage it anyway.

Committing this now. Thanks!

-- 
  Commercial curl and libcurl Technical Support: http://haxx.se/curl.html
Received on 2006-12-22