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.

Can the CURLOPT_WRITEFUNCTION ever be called when CURLOPT_UPLOAD is set to 1?

From: Andreas Falkenhahn via curl-library <>
Date: Sat, 16 Jan 2021 21:58:56 +0100

I'm uploading data by passing the remote URL in CURLOPT_URL and providing data to upload through my CURLOPT_READFUNCTION. Now I was wondering if there are any protocols that actually return data through the CURLOPT_WRITEFUNCTION after the upload has completed?

For example, when uploading to HTTP I need to listen to the CURLOPT_WRITEFUNCTION as well because after the upload has completed, a HTML page generated by PHP script that handles the upload is returned. However, when doing HTTP uploads I'm not using CURLOPT_READFUNCTION and CURLOPT_UPLOAD at all but just CURLOPT_MIMEPOST.

That's why I was wondering if this is some sort of rule, i.e. is it safe to assume that CURLOPT_WRITEFUNCTION will never be called when CURLOPT_UPLOAD has been set to 1 or are there protocols that use CURLOPT_WRITEFUNCTION even when upload has been activated by setting CURLOPT_UPLOAD to 1?

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