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: Can the CURLOPT_WRITEFUNCTION ever be called when CURLOPT_UPLOAD is set to 1?

From: Andreas Falkenhahn via curl-library <>
Date: Sun, 17 Jan 2021 12:10:47 +0100

On 16.01.2021 at 23:00 Daniel Stenberg wrote:

> We should probably make this clear in the docs somewhere, but I'm not really
> sure how or where...

Thanks for clarification! Here are some suggestions concerning better documentation from a user's point of view:

1) Does CURLOPT_MIMEPOST imply CURLOPT_UPLOAD? If it does, it should be mentioned in one of the man pages because as it stands, it's unclear whether CURLOPT_UPLOAD has to be set as well when CURLOPT_MIMEPOST has been set already or whether the two are mutually exclusive.


2) If setting CURLOPT_UPLOAD to 1 should only be done when supplying the data via CURLOPT_READFUNCTION it should be mentioned on the man page of CURLOPT_UPLOAD that setting CURLOPT_UPLOAD to 1 should only be done if one intends to use CURLOPT_READFUNCTION to provide the data and not use other means of providing the data like through CURLOPT_MIMEPOST.

Currently this is somewhat unclear because all that CURLOPT_UPLOAD says is that "the CURLOPT_READDATA and CURLOPT_INFILESIZE or CURLOPT_INFILESIZE_LARGE options are also interesting for uploads" which is very blurry because it doesn't make it clear whether setting CURLOPT_UPLOAD to 1 will force the user to use CURLOPT_READFUNCTION...

Best regards,
 Andreas Falkenhahn                  
Received on 2021-01-17