cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: CURLOPT_HEADERFUNCTION documentation and examples patches, now with actual patches!

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Sat, 24 May 2008 12:42:02 +0200 (CEST)

On Sat, 24 May 2008, Nikolai Kondrashov wrote:

> I was reminding myself to not to forget the attachments, like, 5 times and
> forgot them anyway, sorry :( So, here they are.

[...]

+ retcode = read(fd, ptr, size * nmemb) * size;

[...]

+ return fwrite(ptr,size,nmemb,stream) * size;

Sorry, but these changes are incorrect (and it seems they all are of the same
kind). The return code (for both read and write callbacks) should be the
amount of data they have taken care of, which is exactly what read() and
fwrite() etc typically already return. The day we'd change 'size' to be
something else than 1 when passed to the callback, your changes would make the
examples return that amount multiplied a value and if that value isn't 1 the
return code is plain wrong.

Your man page patch looks fine and I'll commit it soon.

-- 
  / daniel.haxx.se
Received on 2008-05-24