cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: CURLOPT_HEADERFUNCTION Documentation Issue

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Thu, 25 Jan 2007 09:36:46 +0100 (CET)

On Wed, 24 Jan 2007, Achint Mehta wrote:

> curl Library version : 7.16.0

(consider the curl-library mailing list for libcurl stuff, this reply is CC'ed
over there for information)

> "The callback function must return the number of bytes actually taken care
> of, or return -1 to signal error to the library "
>
> The return type of this function is size_t which is of type unsigned int
> (atleast on my system). So would it be appropriate to return -1 from this
> function?

I agree that -1 on unsigned is not so very nice.

> The code form where this function is called checks whether the function
> returned the same number of bytes that was given to it instead of checking
> it against 0xffffffff or -1.

Yeps.

> 1. Should the documentation be updated to tell that returning a value other
> size * nmemb would raise the error? or,

Yes I think it should. Please provide a patch!

> 2. Change the prototype of callback function from size_t function( void
> *ptr, size_t size, size_t nmemb, void *stream); to ssize_t function( void
> *ptr, ssize_t size, ssize_t nmemb, void *stream); or,

No, we don't want that without very careful consideration and good reason.
This is not a good enough reason in my view.

-- 
  Commercial curl and libcurl Technical Support: http://haxx.se/curl.html
Received on 2007-01-25