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.

Clarification in man page for CURLOPT_WRITEFUNCTION for nmemb==0

From: Nicolas Roeser via curl-library <curl-library_at_cool.haxx.se>
Date: Thu, 23 May 2019 23:19:53 +0200

Hello!

CURLOPT_WRITEFUNCTION(3) from curl-7.65.0 says:
| This callback function gets called by libcurl as soon as there is data
| received that needs to be saved. For most transfers, this callback
| gets called many times and each invoke delivers another chunk of data.
[…]
|
| The callback function will be passed as much data as possible
| in all invokes, but you must not make any assumptions. It may be one
| byte, it may be thousands.
[…]

From these statements, it is not 100 % clear to me whether the function may be called with 0 bytes.

|
| 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 would love to see an addition to the man page in exactly one of the following three forms:

1) This function will never be called with zero bytes if the transferred file is not empty.

2) This function may also be called with zero bytes if the transferred file is not empty.

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.

Maybe reword the text a bit. The sentence can be moved further up to appear in/after one of the other paragraphs I have cited.

I would have sent a patch, but I don’t know what the answer is.

Cheers

-- 
Nico
Nicolas Roeser
kiz – Information Systems Department, Ulm University
-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette:   https://curl.haxx.se/mail/etiquette.html
Received on 2019-05-23