quickjs-tart

quickjs-based runtime for wallet-core logic
Log | Files | Refs | README | LICENSE

libcurl-share.md (1991B)


      1 ---
      2 c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
      3 SPDX-License-Identifier: curl
      4 Title: libcurl-share
      5 Section: 3
      6 Source: libcurl
      7 See-also:
      8   - curl_share_cleanup (3)
      9   - curl_share_init (3)
     10   - curl_share_setopt (3)
     11   - libcurl-easy (3)
     12   - libcurl-errors (3)
     13   - libcurl-multi (3)
     14 Protocol:
     15   - All
     16 Added-in: n/a
     17 ---
     18 
     19 # NAME
     20 
     21 libcurl-share - how to use the share interface
     22 
     23 # DESCRIPTION
     24 
     25 This is an overview on how to use the libcurl share interface in your C
     26 programs. There are specific man pages for each function mentioned in
     27 here.
     28 
     29 All functions in the share interface are prefixed with curl_share.
     30 
     31 # OBJECTIVES
     32 
     33 The share interface was added to enable sharing of data between curl handles.
     34 
     35 # ONE SET OF DATA - MANY TRANSFERS
     36 
     37 You can have multiple easy handles share data between them. Have them update
     38 and use the **same** cookie database, DNS cache, TLS session cache and/or
     39 connection cache. This way, each single transfer takes advantage from data
     40 updates made by the other transfer(s).
     41 
     42 # SHARE OBJECT
     43 
     44 You create a shared object with curl_share_init(3). It returns a handle
     45 for a newly created one.
     46 
     47 You tell the shared object what data you want it to share by using
     48 curl_share_setopt(3).
     49 
     50 Since you can use this share from multiple threads, and libcurl has no
     51 internal thread synchronization, you must provide mutex callbacks if you are
     52 using this multi-threaded. You set lock and unlock functions with
     53 curl_share_setopt(3) too.
     54 
     55 Then, you make an easy handle to use this share, you set the
     56 CURLOPT_SHARE(3) option with curl_easy_setopt(3), and pass in
     57 share handle. You can make any number of easy handles share the same share
     58 handle.
     59 
     60 To make an easy handle stop using that particular share, you set
     61 CURLOPT_SHARE(3) to NULL for that easy handle. To make a handle stop
     62 sharing a particular data, you can CURLSHOPT_UNSHARE(3) it.
     63 
     64 When you are done using the share, make sure that no easy handle is still using
     65 it, and call curl_share_cleanup(3) on the handle.