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: Timothe Litt <litt_at_acm.org>
Date: Thu, 20 Apr 2023 06:31:13 -0400


On 20-Apr-23 05:24, Frank Gevaerts via curl-library wrote:
> On Wed, Apr 19, 2023 at 06:47:42PM +0200, Andreas Falkenhahn via curl-library wrote:
>> Many manpages of curl options that take a string say: "The application does not have to keep the string around after setting this option". Does this imply that curl options which do NOT contain this phrase must ensure the string pointer passed to the option remains valid after calling curl_easy_setopt()?
> In principle, yes. Oversights happen so some manpages might not have
> that paragraph while they should though.
>
>> For example, CURLOPT_DOH_URL doesn't contain the phrase. Does this mean that the string pointer must remain valid after calling curl_easy_setopt() on CURLOPT_DOH_URL?
> Based on the code, I think CURLOPT_DOH_URL actually *does* duplicate the
> string so this feels like one of those oversights to me.
>
> Disclaimer: I'm not a core curl developer, so don't take anything I say
> as a guarantee for the future (Daniel is away for the week though, I
> don't know if he'll be able to reply to emails), but I did add many of
> those paragraphs back in 2016 (before DOH was added...)
>
> Frank
>
>> --
>> Best regards,
>> Andreas Falkenhahnmailto:andreas_at_falkenhahn.com


If there are any cases where the string is not copied and must be
retained, the documentation should say so explicitly.

Omissions are a poor form of documentation since they lead to assumptions.

Assumptions tend to result in bugs.


Timothe Litt
ACM Distinguished Engineer
--------------------------
This communication may not represent the ACM or my employer's views,
if any, on the matters discussed.


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