curl / Mailing Lists / curl-library / Single Mail
Buy commercial curl support from WolfSSL. We help you work out your issues, debug your libcurl applications, use the API, port to new platforms, add new features and more. With a team lead by the curl founder himself.

Re: Clarification in man page for CURLOPT_WRITEFUNCTION for nmemb==0

From: Nicolas Roeser via curl-library <>
Date: Fri, 24 May 2019 00:01:08 +0200

On 2019-05-23 at 23:29:45+02:00, Daniel Stenberg wrote:
> On Thu, 23 May 2019, Nicolas Roeser via curl-library wrote:
> > | This function may be called with zero bytes data if the transferred
> > | file is empty.
> >
> > Ahh, good to know. But _still_, I am not sure whether the function may be
> > called with 0 bytes _if the transferred file is *not* empty._
> I think it doesn't specifically specify that because we haven't wanted to make
> that promise. Partly because it seems that applications don't really *need*
> that promise and people have not asked for it. Until now.

I see; that’s actually what I had assumed. Fine with me.

> > 3) Depending on the protocol [or something else], this function may or will
> > never be called with zero bytes if the transferred file is not empty.
> I want to say this as that's basically what is implied now and it makes the
> least amount of promise and we don't have to change anything... =)

Heh, okay.

> This said, I don't think it currently actually ever calls the callback with
> zero bytes other than the specific use case already mentioned above!

… but still, users will have to code defensively if no promise is made, and be ready to handle all cases.

Many thanks, Daniel!

Nicolas Roeser
kiz – Information Systems Department, Ulm University
Received on 2019-05-24