libcurl-share.3 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. .\" generated by cd2nroff 0.1 from libcurl-share.md
  2. .TH libcurl-share 3 "2025-01-17" libcurl
  3. .SH NAME
  4. libcurl\-share \- how to use the share interface
  5. .SH DESCRIPTION
  6. This is an overview on how to use the libcurl share interface in your C
  7. programs. There are specific man pages for each function mentioned in
  8. here.
  9. All functions in the share interface are prefixed with curl_share.
  10. .SH OBJECTIVES
  11. The share interface was added to enable sharing of data between curl handles.
  12. .SH ONE SET OF DATA - MANY TRANSFERS
  13. You can have multiple easy handles share data between them. Have them update
  14. and use the \fBsame\fP cookie database, DNS cache, TLS session cache and/or
  15. connection cache! This way, each single transfer takes advantage from data
  16. updates made by the other transfer(s).
  17. .SH SHARE OBJECT
  18. You create a shared object with \fIcurl_share_init(3)\fP. It returns a handle
  19. for a newly created one.
  20. You tell the shared object what data you want it to share by using
  21. \fIcurl_share_setopt(3)\fP.
  22. Since you can use this share from multiple threads, and libcurl has no
  23. internal thread synchronization, you must provide mutex callbacks if you are
  24. using this multi\-threaded. You set lock and unlock functions with
  25. \fIcurl_share_setopt(3)\fP too.
  26. Then, you make an easy handle to use this share, you set the
  27. \fICURLOPT_SHARE(3)\fP option with \fIcurl_easy_setopt(3)\fP, and pass in
  28. share handle. You can make any number of easy handles share the same share
  29. handle.
  30. To make an easy handle stop using that particular share, you set
  31. \fICURLOPT_SHARE(3)\fP to NULL for that easy handle. To make a handle stop
  32. sharing a particular data, you can \fICURLSHOPT_UNSHARE(3)\fP it.
  33. When you are done using the share, make sure that no easy handle is still using
  34. it, and call \fIcurl_share_cleanup(3)\fP on the handle.
  35. .SH SEE ALSO
  36. .BR curl_share_cleanup (3),
  37. .BR curl_share_init (3),
  38. .BR curl_share_setopt (3),
  39. .BR libcurl-easy (3),
  40. .BR libcurl-errors (3),
  41. .BR libcurl-multi (3)