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
This commit is contained in:
Stefan Eissing 2025-07-04 09:08:39 +02:00 committed by Daniel Stenberg
parent bed49a0462
commit d9c2d4bc10
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
2 changed files with 10 additions and 0 deletions

View file

@ -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

View file

@ -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.