From: Stefan Eissing Date: Fri, 4 Jul 2025 07:08:39 +0000 (+0200) Subject: docs: warn about lifetime in CURLOPT_CLOSESOCKET* X-Git-Tag: rc-8_15_0-3~45 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d9c2d4bc10ef721f87001fff3e690539c86aeec9;p=thirdparty%2Fcurl.git docs: warn about lifetime in CURLOPT_CLOSESOCKET* Callback and data set via CURLOPT_CLOSESOCKETFUNCTION and CURLOPT_CLOSESOCKETDATA may get used after the easy handle has been cleaned up. Inform about that. Closes #17816 --- diff --git a/docs/libcurl/opts/CURLOPT_CLOSESOCKETDATA.md b/docs/libcurl/opts/CURLOPT_CLOSESOCKETDATA.md index 3ad41d0b07..a1bdd9c3fe 100644 --- a/docs/libcurl/opts/CURLOPT_CLOSESOCKETDATA.md +++ b/docs/libcurl/opts/CURLOPT_CLOSESOCKETDATA.md @@ -31,6 +31,11 @@ Pass a *pointer* that remains untouched by libcurl and passed as the first argument in the closesocket callback set with CURLOPT_CLOSESOCKETFUNCTION(3). +Note that when using multi/share handles, your callback may get invoked even +after the easy handle has been cleaned up. The callback and data is +inherited by a new connection and that connection may live longer +than the transfer itself in the multi/share handle's connection cache. + # DEFAULT NULL diff --git a/docs/libcurl/opts/CURLOPT_CLOSESOCKETFUNCTION.md b/docs/libcurl/opts/CURLOPT_CLOSESOCKETFUNCTION.md index 532aaf19df..7f1bf592dc 100644 --- a/docs/libcurl/opts/CURLOPT_CLOSESOCKETFUNCTION.md +++ b/docs/libcurl/opts/CURLOPT_CLOSESOCKETFUNCTION.md @@ -42,6 +42,11 @@ The *clientp* pointer is set with CURLOPT_CLOSESOCKETDATA(3). *item* is the socket libcurl wants to be closed. +Note that when using multi/share handles, your callback may get invoked even +after the easy handle has been cleaned up. The callback and data is +inherited by a new connection and that connection may live longer +than the transfer itself in the multi/share handle's connection cache. + # DEFAULT Use the standard socket close function.