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: Frank Gevaerts via curl-library <curl-library_at_lists.haxx.se>
Date: Thu, 20 Apr 2023 11:24:46 +0200

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 Falkenhahn mailto:andreas_at_falkenhahn.com

-- 
"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it." - Brian W. Kernighan
-- 
Unsubscribe: https://lists.haxx.se/mailman/listinfo/curl-library
Etiquette:   https://curl.se/mail/etiquette.html
Received on 2023-04-20