]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
docs: warn about lifetime in CURLOPT_CLOSESOCKET*
authorStefan Eissing <stefan@eissing.org>
Fri, 4 Jul 2025 07:08:39 +0000 (09:08 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Fri, 4 Jul 2025 10:55:26 +0000 (12:55 +0200)
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

docs/libcurl/opts/CURLOPT_CLOSESOCKETDATA.md
docs/libcurl/opts/CURLOPT_CLOSESOCKETFUNCTION.md

index 3ad41d0b072c1d6ff083295cde9f22deb738132b..a1bdd9c3feacfd73c34920af31e1caa9cc399912 100644 (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
index 532aaf19dfc9b48a14438842da8cc338a872d99c..7f1bf592dca442cf1d5d496987b935d1a00393e4 100644 (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.