blob: c7cd65548197cb6386505b31485ecab760afb956 [file] [log] [blame]
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001.\" **************************************************************************
2.\" * _ _ ____ _
3.\" * Project ___| | | | _ \| |
4.\" * / __| | | | |_) | |
5.\" * | (__| |_| | _ <| |___
6.\" * \___|\___/|_| \_\_____|
7.\" *
8.\" * Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
9.\" *
10.\" * This software is licensed as described in the file COPYING, which
11.\" * you should have received as part of this distribution. The terms
Alex Deymo8f1a2142016-06-28 14:49:26 -070012.\" * are also available at https://curl.haxx.se/docs/copyright.html.
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -070013.\" *
14.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell
15.\" * copies of the Software, and permit persons to whom the Software is
16.\" * furnished to do so, under the terms of the COPYING file.
17.\" *
18.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19.\" * KIND, either express or implied.
20.\" *
21.\" **************************************************************************
Lucas Eckels9bd90e62012-08-06 15:07:02 -070022.TH libcurl-share 3 "8 Aug 2003" "libcurl 7.10.7" "libcurl share interface"
23.SH NAME
24libcurl-share \- how to use the share interface
25.SH DESCRIPTION
26This is an overview on how to use the libcurl share interface in your C
27programs. There are specific man pages for each function mentioned in
28here.
29
30All functions in the share interface are prefixed with curl_share.
31
32.SH "OBJECTIVES"
33The share interface was added to enable sharing of data between curl
34\&"handles".
35.SH "ONE SET OF DATA - MANY TRANSFERS"
36You can have multiple easy handles share data between them. Have them update
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -070037and use the \fBsame\fP cookie database, DNS cache, TLS session cache! This
38way, each single transfer will take advantage from data updates made by the
39other transfer(s). The sharing interface, however, does not share active or
40persistent connections between different easy handles.
Lucas Eckels9bd90e62012-08-06 15:07:02 -070041.SH "SHARE OBJECT"
42You create a shared object with \fIcurl_share_init(3)\fP. It returns a handle
43for a newly created one.
44
45You tell the shared object what data you want it to share by using
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -070046\fIcurl_share_setopt(3)\fP.
Lucas Eckels9bd90e62012-08-06 15:07:02 -070047
48Since you can use this share from multiple threads, and libcurl has no
49internal thread synchronization, you must provide mutex callbacks if you're
50using this multi-threaded. You set lock and unlock functions with
51\fIcurl_share_setopt(3)\fP too.
52
53Then, you make an easy handle to use this share, you set the
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -070054\fICURLOPT_SHARE(3)\fP option with \fIcurl_easy_setopt(3)\fP, and pass in
55share handle. You can make any number of easy handles share the same share
56handle.
Lucas Eckels9bd90e62012-08-06 15:07:02 -070057
58To make an easy handle stop using that particular share, you set
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -070059\fICURLOPT_SHARE(3)\fP to NULL for that easy handle. To make a handle stop
Lucas Eckels9bd90e62012-08-06 15:07:02 -070060sharing a particular data, you can \fICURLSHOPT_UNSHARE\fP it.
61
62When you're done using the share, make sure that no easy handle is still using
63it, and call \fIcurl_share_cleanup(3)\fP on the handle.
64.SH "SEE ALSO"
65.BR curl_share_init "(3), " curl_share_setopt "(3), " curl_share_cleanup "(3)"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -070066.BR libcurl-errors "(3), " libcurl-easy "(3), " libcurl-multi "(3) "