CURLSHOPT_SHARE.3 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. .\" **************************************************************************
  2. .\" * _ _ ____ _
  3. .\" * Project ___| | | | _ \| |
  4. .\" * / __| | | | |_) | |
  5. .\" * | (__| |_| | _ <| |___
  6. .\" * \___|\___/|_| \_\_____|
  7. .\" *
  8. .\" * Copyright (C) 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
  12. .\" * are also available at https://curl.se/docs/copyright.html.
  13. .\" *
  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. .\" * SPDX-License-Identifier: curl
  22. .\" *
  23. .\" **************************************************************************
  24. .TH CURLSHOPT_SHARE 3 "8 Aug 2003" libcurl libcurl
  25. .SH NAME
  26. CURLSHOPT_SHARE - add data to share
  27. .SH SYNOPSIS
  28. .nf
  29. #include <curl/curl.h>
  30. CURLSHcode curl_share_setopt(CURLSH *share, CURLSHOPT_SHARE, long type);
  31. .fi
  32. .SH DESCRIPTION
  33. The \fItype\fP parameter specifies what specific data that should be shared
  34. and kept in the share object that was created with \fIcurl_share_init(3)\fP.
  35. The given \fItype\fP must be be one of the values described below. You can set
  36. \fICURLSHOPT_SHARE(3)\fP multiple times with different data arguments to have
  37. the share object share multiple types of data. Unset a type again by setting
  38. \fICURLSHOPT_UNSHARE(3)\fP.
  39. .IP CURL_LOCK_DATA_COOKIE
  40. Cookie data will be shared across the easy handles using this shared object.
  41. Note that this does not activate an easy handle's cookie handling. You can do
  42. that separately by using \fICURLOPT_COOKIEFILE(3)\fP for example.
  43. .IP CURL_LOCK_DATA_DNS
  44. Cached DNS hosts will be shared across the easy handles using this shared
  45. object. Note that when you use the multi interface, all easy handles added to
  46. the same multi handle will share DNS cache by default without using this
  47. option.
  48. .IP CURL_LOCK_DATA_SSL_SESSION
  49. SSL session IDs will be shared across the easy handles using this shared
  50. object. This will reduce the time spent in the SSL handshake when reconnecting
  51. to the same server. Note SSL session IDs are reused within the same easy
  52. handle by default. Note this symbol was added in 7.10.3 but was not
  53. implemented until 7.23.0.
  54. .IP CURL_LOCK_DATA_CONNECT
  55. Put the connection cache in the share object and make all easy handles using
  56. this share object share the connection cache.
  57. It is not supported to share connections between multiple concurrent threads.
  58. Connections that are used for HTTP/1.1 Pipelining or HTTP/2 multiplexing only
  59. get additional transfers added to them if the existing connection is held by
  60. the same multi or easy handle. libcurl does not support doing HTTP/2 streams
  61. in different threads using a shared connection.
  62. Support for \fBCURL_LOCK_DATA_CONNECT\fP was added in 7.57.0, but the symbol
  63. existed before this.
  64. Note that when you use the multi interface, all easy handles added to the same
  65. multi handle will share connection cache by default without using this option.
  66. .IP CURL_LOCK_DATA_PSL
  67. The Public Suffix List stored in the share object is made available to all
  68. easy handle bound to the later. Since the Public Suffix List is periodically
  69. refreshed, this avoids updates in too many different contexts.
  70. Added in 7.61.0.
  71. Note that when you use the multi interface, all easy handles added to the same
  72. multi handle will share PSL cache by default without using this option.
  73. .IP CURL_LOCK_DATA_HSTS
  74. The in-memory HSTS cache.
  75. It is not supported to share the HSTS between multiple concurrent threads.
  76. Added in 7.88.0
  77. .SH PROTOCOLS
  78. All
  79. .SH EXAMPLE
  80. .nf
  81. CURLSHcode sh;
  82. share = curl_share_init();
  83. sh = curl_share_setopt(share, CURLSHOPT_SHARE, CURL_LOCK_DATA_COOKIE);
  84. if(sh)
  85. printf("Error: %s\\n", curl_share_strerror(sh));
  86. .fi
  87. .SH AVAILABILITY
  88. Added in 7.10
  89. .SH RETURN VALUE
  90. CURLSHE_OK (zero) means that the option was set properly, non-zero means an
  91. error occurred. See \fIlibcurl-errors(3)\fP for the full list with
  92. descriptions.
  93. .SH "SEE ALSO"
  94. .BR CURLSHOPT_UNSHARE "(3), "
  95. .BR curl_share_setopt "(3), " curl_share_cleanup "(3), " curl_share_init "(3)"