Imported Upstream version 7.40.0
[platform/upstream/curl.git] / docs / libcurl / libcurl-share.html
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
2  "http://www.w3.org/TR/html4/loose.dtd">
3 <html><head>
4 <title>libcurl-share man page</title>
5 <meta name="generator" content="roffit">
6 <STYLE type="text/css">
7 P.level0 {
8  padding-left: 2em;
9 }
10
11 P.level1 {
12  padding-left: 4em;
13 }
14
15 P.level2 {
16  padding-left: 6em;
17 }
18
19 span.emphasis {
20  font-style: italic;
21 }
22
23 span.bold {
24  font-weight: bold;
25 }
26
27 span.manpage {
28  font-weight: bold;
29 }
30
31 h2.nroffsh {
32  background-color: #e0e0e0;
33 }
34
35 span.nroffip {
36  font-weight: bold;
37  font-size: 120%;
38  font-family: monospace;
39 }
40
41 p.roffit {
42  text-align: center;
43  font-size: 80%;
44 }
45 </STYLE>
46 </head><body>
47
48 <p class="level0"><a name="NAME"></a><h2 class="nroffsh">NAME</h2>
49 <p class="level0">libcurl-share - how to use the share interface <a name="DESCRIPTION"></a><h2 class="nroffsh">DESCRIPTION</h2>
50 <p class="level0">This is an overview on how to use the libcurl share interface in your C programs. There are specific man pages for each function mentioned in here. 
51 <p class="level0">All functions in the share interface are prefixed with curl_share. 
52 <p class="level0"><a name="OBJECTIVES"></a><h2 class="nroffsh">OBJECTIVES</h2>
53 <p class="level0">The share interface was added to enable sharing of data between curl "handles". <a name="ONE"></a><h2 class="nroffsh">ONE SET OF DATA - MANY TRANSFERS</h2>
54 <p class="level0">You can have multiple easy handles share data between them. Have them update and use the <span Class="bold">same</span> cookie database, DNS cache, TLS session cache! This way, each single transfer will take advantage from data updates made by the other transfer(s). The sharing interface, however, does not share active or persistent connections between different easy handles. <a name="SHARE"></a><h2 class="nroffsh">SHARE OBJECT</h2>
55 <p class="level0">You create a shared object with <a Class="emphasis" href="./curl_share_init.html">curl_share_init</a>. It returns a handle for a newly created one. 
56 <p class="level0">You tell the shared object what data you want it to share by using <a Class="emphasis" href="./curl_share_setopt.html">curl_share_setopt</a>. 
57 <p class="level0">Since you can use this share from multiple threads, and libcurl has no internal thread synchronization, you must provide mutex callbacks if you're using this multi-threaded. You set lock and unlock functions with <a Class="emphasis" href="./curl_share_setopt.html">curl_share_setopt</a> too. 
58 <p class="level0">Then, you make an easy handle to use this share, you set the <span Class="emphasis">CURLOPT_SHARE(3)</span> option with <a Class="emphasis" href="./curl_easy_setopt.html">curl_easy_setopt</a>, and pass in share handle. You can make any number of easy handles share the same share handle. 
59 <p class="level0">To make an easy handle stop using that particular share, you set <span Class="emphasis">CURLOPT_SHARE(3)</span> to NULL for that easy handle. To make a handle stop sharing a particular data, you can <span Class="emphasis">CURLSHOPT_UNSHARE</span> it. 
60 <p class="level0">When you're done using the share, make sure that no easy handle is still using it, and call <a Class="emphasis" href="./curl_share_cleanup.html">curl_share_cleanup</a> on the handle. <a name="SEE"></a><h2 class="nroffsh">SEE ALSO</h2>
61 <p class="level0"><a Class="manpage" href="./curl_share_init.html">curl_share_init</a>, <a Class="manpage" href="./curl_share_setopt.html">curl_share_setopt</a>, <a Class="manpage" href="./curl_share_cleanup.html">curl_share_cleanup</a>, <a Class="manpage" href="./libcurl-errors.html">libcurl-errors</a>, <a Class="manpage" href="./libcurl-easy.html">libcurl-easy</a>, <a Class="manpage" href="./libcurl-multi.html">libcurl-multi</a>, <p class="roffit">
62  This HTML page was made with <a href="http://daniel.haxx.se/projects/roffit/">roffit</a>.
63 </body></html>