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: Imagining a thread-safe curl_global_init

From: Patrick Monnerat via curl-library <curl-library_at_cool.haxx.se>
Date: Sun, 1 Mar 2020 13:22:18 +0100

On 3/1/20 11:47 AM, Daniel Stenberg via curl-library wrote:
> There are at least three remaining issues left.

About curl_version*:

The returned information is invariant though each call to these
functions: IMHO the only reason why they are not thread-safe is (except
for possible non thread-safeness of an external component) the way the
info is stored in struct/buffer.

If we change the code to only overwrite struct/buffer bytes with the
same value, we should make these function thread-safe without having to
to implement alternate functions. The only thing that I would recommend
is to declare (at least conceptually) the existing functions result as
const.

Among the changes to perform is avoiding the use of functions that store
a null-terminator after strings (like strcpy, strcat, msnprintf)
directly targetting the static buffer.

-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette: https://curl.haxx.se/mail/etiquette.html
Received on 2020-03-01