1CURLSHOPT_SHARE(3)              libcurl Manual              CURLSHOPT_SHARE(3)
2
3
4

NAME

6       CURLSHOPT_SHARE - add data to share
7

SYNOPSIS

9       #include <curl/curl.h>
10
11       CURLSHcode curl_share_setopt(CURLSH *share, CURLSHOPT_SHARE, long type);
12

DESCRIPTION

14       The  type  parameter specifies what specific data that should be shared
15       and kept in the share object that was created with  curl_share_init(3).
16       The  given  type  must be be one of the values described below. You can
17       set CURLSHOPT_SHARE(3) multiple times with different data arguments  to
18       have  the share object share multiple types of data. Unset a type again
19       by setting CURLSHOPT_UNSHARE(3).
20
21       CURL_LOCK_DATA_COOKIE
22              Cookie data will be shared across the easy  handles  using  this
23              shared  object.   Note  that this does not activate an easy han‐
24              dle's cookie handling. You can do that separately by using  CUR‐
25              LOPT_COOKIEFILE(3) for example.
26
27       CURL_LOCK_DATA_DNS
28              Cached  DNS  hosts  will be shared across the easy handles using
29              this shared object. Note that when you use the multi  interface,
30              all  easy  handles added to the same multi handle will share DNS
31              cache by default without using this option.
32
33       CURL_LOCK_DATA_SSL_SESSION
34              SSL session IDs will be shared across  the  easy  handles  using
35              this  shared  object. This will reduce the time spent in the SSL
36              handshake when reconnecting to the same server. Note SSL session
37              IDs are reused within the same easy handle by default. Note this
38              symbol was added in 7.10.3 but was not implemented until 7.23.0.
39
40       CURL_LOCK_DATA_CONNECT
41              Put the connection cache in the share object and make  all  easy
42              handles using this share object share the connection cache.
43
44              Note  that  due  to a known bug, it is not safe to share connec‐
45              tions this way between multiple concurrent threads.
46
47              Connections that are used for HTTP/1.1 Pipelining or HTTP/2 mul‐
48              tiplexing only get additional transfers added to them if the ex‐
49              isting connection is held by the  same  multi  or  easy  handle.
50              libcurl  does  not  support  doing  HTTP/2  streams in different
51              threads using a shared connection.
52
53              Support for CURL_LOCK_DATA_CONNECT was added in 7.57.0, but  the
54              symbol existed before this.
55
56              Note  that  when  you  use the multi interface, all easy handles
57              added to the same multi handle will share  connection  cache  by
58              default without using this option.
59
60       CURL_LOCK_DATA_PSL
61              The Public Suffix List stored in the share object is made avail‐
62              able to all easy handle bound to the  later.  Since  the  Public
63              Suffix  List  is  periodically refreshed, this avoids updates in
64              too many different contexts.
65
66              Added in 7.61.0.
67
68              Note that when you use the multi  interface,  all  easy  handles
69              added  to  the same multi handle will share PSL cache by default
70              without using this option.
71

PROTOCOLS

73       All
74

EXAMPLE

76         CURLSHcode sh
77         share = curl_share_init();
78         sh = curl_share_setopt(share, CURLSHOPT_SHARE, CURL_LOCK_DATA_COOKIE);
79         if(sh)
80           printf("Error: %s\n", curl_share_strerror(sh));
81

AVAILABILITY

83       Added in 7.10
84

RETURN VALUE

86       CURLSHE_OK (zero) means that the  option  was  set  properly,  non-zero
87       means  an  error occurred. See libcurl-errors(3) for the full list with
88       descriptions.
89

SEE ALSO

91       CURLSHOPT_UNSHARE(3),   curl_share_setopt(3),    curl_share_cleanup(3),
92       curl_share_init(3)
93
94
95
96libcurl 7.82.0                 November 12, 2021            CURLSHOPT_SHARE(3)
Impressum