1libcurl-share(3) libcurl share interface libcurl-share(3)
2
3
4
6 libcurl-share - how to use the share interface
7
9 This is an overview on how to use the libcurl share interface in your C
10 programs. There are specific man pages for each function mentioned in
11 here.
12
13 All functions in the share interface are prefixed with curl_share.
14
15
17 The share interface was added to enable sharing of data between curl
18 "handles".
19
21 You can have multiple easy handles share data between them. Have them
22 update and use the same cookie database, DNS cache, TLS session cache
23 and/or connection cache! This way, each single transfer will take
24 advantage from data updates made by the other transfer(s).
25
27 You create a shared object with curl_share_init(3). It returns a handle
28 for a newly created one.
29
30 You tell the shared object what data you want it to share by using
31 curl_share_setopt(3).
32
33 Since you can use this share from multiple threads, and libcurl has no
34 internal thread synchronization, you must provide mutex callbacks if
35 you're using this multi-threaded. You set lock and unlock functions
36 with curl_share_setopt(3) too.
37
38 Then, you make an easy handle to use this share, you set the CUR‐
39 LOPT_SHARE(3) option with curl_easy_setopt(3), and pass in share han‐
40 dle. You can make any number of easy handles share the same share han‐
41 dle.
42
43 To make an easy handle stop using that particular share, you set CUR‐
44 LOPT_SHARE(3) to NULL for that easy handle. To make a handle stop shar‐
45 ing a particular data, you can CURLSHOPT_UNSHARE it.
46
47 When you're done using the share, make sure that no easy handle is
48 still using it, and call curl_share_cleanup(3) on the handle.
49
51 curl_share_init(3), curl_share_setopt(3), curl_share_cleanup(3)
52 libcurl-errors(3), libcurl-easy(3), libcurl-multi(3)
53
54
55
56libcurl 7.64.0 November 27, 2017 libcurl-share(3)