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: The application does not have to keep the string around after setting this option

From: Henrik Holst via curl-library <curl-library_at_lists.haxx.se>
Date: Thu, 20 Apr 2023 13:12:24 +0200

luckily the man page for CURLOPT_POSTFIELDS already contains that info:

The data pointed to is NOT copied by the library: as a consequence, it
must be preserved
       by the calling application until the associated transfer
finishes. This behaviour can be
       changed (so libcurl does copy the data) by setting the
*CURLOPT_COPYPOSTFIELDS
<https://manpages.ubuntu.com/manpages/bionic/man3/CURLOPT_COPYPOSTFIELDS.3.html>(3)*
option.

/HH


Den tors 20 apr. 2023 kl 13:00 skrev Andreas Falkenhahn via curl-library <
curl-library_at_lists.haxx.se>:

> On 20.04.2023 at 12:31 Timothe Litt via curl-library wrote:
>
> > If there are any cases where the string is not copied and must be
> > retained, the documentation should say so explicitly.
>
> +1
>
> To make matters more confusing, I've also found this information:
>
> "There are currently over 80 options for curl_easy_setopt() that accept a
> string as its third argument. When a string is set in a handle, libcurl
> immediately copies that data so that the application does not have to keep
> the data around for the time the transfer is being done - with one notable
> exception: CURLOPT_POSTFIELDS."
>
> Found here: https://everything.curl.dev/libcurl/options/strings
>
> If that is true, maybe the note "The application does not have to keep the
> string around after setting this option" should be killed from all
> CURLOPT_*
> pages and there should only be a note for CURLOPT_POSTFIELDS that says that
> the string isn't copied.
>
> --
> Best regards,
> Andreas Falkenhahn mailto:
> andreas_at_falkenhahn.com
>
> --
> Unsubscribe: https://lists.haxx.se/mailman/listinfo/curl-library
> Etiquette: https://curl.se/mail/etiquette.html
>


-- 
Unsubscribe: https://lists.haxx.se/mailman/listinfo/curl-library
Etiquette:   https://curl.se/mail/etiquette.html
Received on 2023-04-20