Artifactspublic-v0

curl

master
ply4 git calls156 ms288 KiB2 cachedprotocol v2
127 lines3.8 KiBRaw

NAME

CURLSHOPT_SHARE - add data to share

SYNOPSIS

c
#include <curl/curl.h>

CURLSHcode curl_share_setopt(CURLSH *share, CURLSHOPT_SHARE, int type);

DESCRIPTION

The type parameter specifies what specific data that should be shared and kept in the share object that was created with curl_share_init(3). The given type must be one of the values described below. You can set CURLSHOPT_SHARE(3) multiple times with different data arguments to have the share object share multiple types of data. Unset a type again by setting CURLSHOPT_UNSHARE(3).

Do not add types to a shared object that is being in use. Add them only between transfers.

If any of the data is to be shared in multiple threads then mutex callbacks must be set as well. See CURLSHOPT_LOCKFUNC(3) and CURLSHOPT_UNLOCKFUNC(3).

CURL_LOCK_DATA_COOKIE

Cookie data is shared across the easy handles using this shared object. Note that this does not activate an easy handle's cookie handling. You can do that separately by using CURLOPT_COOKIEFILE(3) for example.

It is not supported to share cookies between multiple concurrent threads.

CURL_LOCK_DATA_DNS

Cached DNS hosts are shared across the easy handles using this shared object. Note that when you use the multi interface, all easy handles added to the same multi handle share the DNS cache by default without using this option.

CURL_LOCK_DATA_SSL_SESSION

SSL sessions are shared across the easy handles using this shared object. This reduces the time spent in the SSL handshake when reconnecting to the same server.

Note that when you use the multi interface, all easy handles added to the same multi handle share the SSL session cache by default without using this option.

CURL_LOCK_DATA_CONNECT

Put the connection cache in the share object and make all easy handles using this share object share the connection cache.

It is not supported to share connections between multiple concurrent threads.

Connections that are used for HTTP/2 or HTTP/3 multiplexing only get additional transfers added to them if the existing connection is held by the same multi or easy handle. libcurl does not support doing multiplexed streams in different threads using a shared connection.

Note that when you use the multi interface, all easy handles added to the same multi handle share the connection cache by default without using this option.

Connection limits set with CURLMOPT_MAX_HOST_CONNECTIONS(3) and CURLMOPT_MAX_TOTAL_CONNECTIONS(3) also apply to transfers using a shared connection cache. Each transfer applies the limits of the multi handle it runs on to the shared cache.

CURL_LOCK_DATA_PSL

The Public Suffix List stored in the share object is made available to all easy handle bound to the later. Since the Public Suffix List is periodically refreshed, this avoids updates in too many different contexts.

Added in 7.61.0.

Note that when you use the multi interface, all easy handles added to the same multi handle share the PSL cache by default without using this option.

CURL_LOCK_DATA_HSTS

The in-memory HSTS cache.

It is not supported to share the HSTS between multiple concurrent threads.

Added in 7.88.0

%PROTOCOLS%

EXAMPLE

c
int main(void)
{
  CURLSHcode sh;
  CURLSH *share = curl_share_init();
  sh = curl_share_setopt(share, CURLSHOPT_SHARE, CURL_LOCK_DATA_COOKIE);
  if(sh)
    printf("Error: %s\n", curl_share_strerror(sh));
}

%AVAILABILITY%

RETURN VALUE

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

1---
2c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
3SPDX-License-Identifier: curl
4Title: CURLSHOPT_SHARE
5Section: 3
6Source: libcurl
7See-also:
8 - CURLSHOPT_UNSHARE (3)
9 - curl_share_cleanup (3)
10 - curl_share_init (3)
11 - curl_share_setopt (3)
12Protocol:
13 - All
14Added-in: 7.10.3
15---
17# NAME
19CURLSHOPT_SHARE - add data to share
21# SYNOPSIS
23~~~c
24#include <curl/curl.h>
26CURLSHcode curl_share_setopt(CURLSH *share, CURLSHOPT_SHARE, int type);
27~~~
29# DESCRIPTION
31The *type* parameter specifies what specific data that should be shared
32and kept in the share object that was created with curl_share_init(3).
33The given *type* must be one of the values described below. You can set
34CURLSHOPT_SHARE(3) multiple times with different data arguments to have
35the share object share multiple types of data. Unset a type again by setting
36CURLSHOPT_UNSHARE(3).
38Do not add types to a shared object that is being in use. Add them only
39between transfers.
41If any of the data is to be shared in multiple threads then mutex callbacks
42must be set as well. See CURLSHOPT_LOCKFUNC(3) and CURLSHOPT_UNLOCKFUNC(3).
44## CURL_LOCK_DATA_COOKIE
46Cookie data is shared across the easy handles using this shared object. Note
47that this does not activate an easy handle's cookie handling. You can do that
48separately by using CURLOPT_COOKIEFILE(3) for example.
50It is not supported to share cookies between multiple concurrent threads.
52## CURL_LOCK_DATA_DNS
54Cached DNS hosts are shared across the easy handles using this shared
55object. Note that when you use the multi interface, all easy handles added to
56the same multi handle share the DNS cache by default without using this option.
58## CURL_LOCK_DATA_SSL_SESSION
60SSL sessions are shared across the easy handles using this shared object. This
61reduces the time spent in the SSL handshake when reconnecting to the same
62server.
64Note that when you use the multi interface, all easy handles added to the same
65multi handle share the SSL session cache by default without using this option.
67## CURL_LOCK_DATA_CONNECT
69Put the connection cache in the share object and make all easy handles using
70this share object share the connection cache.
72It is not supported to share connections between multiple concurrent threads.
74Connections that are used for HTTP/2 or HTTP/3 multiplexing only get
75additional transfers added to them if the existing connection is held by the
76same multi or easy handle. libcurl does not support doing multiplexed streams
77in different threads using a shared connection.
79Note that when you use the multi interface, all easy handles added to the same
80multi handle share the connection cache by default without using this option.
82Connection limits set with CURLMOPT_MAX_HOST_CONNECTIONS(3) and
83CURLMOPT_MAX_TOTAL_CONNECTIONS(3) also apply to transfers using a shared
84connection cache. Each transfer applies the limits of the multi handle it
85runs on to the shared cache.
87## CURL_LOCK_DATA_PSL
89The Public Suffix List stored in the share object is made available to all
90easy handle bound to the later. Since the Public Suffix List is periodically
91refreshed, this avoids updates in too many different contexts.
93Added in 7.61.0.
95Note that when you use the multi interface, all easy handles added to the same
96multi handle share the PSL cache by default without using this option.
98## CURL_LOCK_DATA_HSTS
100The in-memory HSTS cache.
102It is not supported to share the HSTS between multiple concurrent threads.
104Added in 7.88.0
106# %PROTOCOLS%
108# EXAMPLE
110~~~c
111int main(void)
113 CURLSHcode sh;
114 CURLSH *share = curl_share_init();
115 sh = curl_share_setopt(share, CURLSHOPT_SHARE, CURL_LOCK_DATA_COOKIE);
116 if(sh)
117 printf("Error: %s\n", curl_share_strerror(sh));
119~~~
121# %AVAILABILITY%
123# RETURN VALUE
125CURLSHE_OK (zero) means that the option was set properly, non-zero means an
126error occurred. See libcurl-errors(3) for the full list with
127descriptions.
Diagnostics4 git calls · 156 ms
CallStatusSizeTime0156 ms
discover200152 B3 ms
git.upload-pack discover
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=fetch
git.upstream.dur_ms=2
git.response.bytes=152
git.server.agent=gitty/1.0
git.server.object_format=sha1
git.server.caps=agent ls-refs fetch object-format
git.server.fetch=shallow filter sideband-all
git.protocol.version=2
git.pkt.frames=8
git.pkt.data=6
git.pkt.flush=2
git.pkt.delim=0
git.pkt.bytes=152
git.pkt.payload.max=34
ls-refs200149 B · hit2 ms
git.upload-pack ls-refs
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=ls-refs
git.upstream.dur_ms=2
git.response.bytes=149
git.response.cache=HIT
git.response.duration_ms=2
git.protocol.version=2
git.pkt.frames=3
git.pkt.data=2
git.pkt.flush=1
git.pkt.delim=0
git.pkt.bytes=149
git.pkt.payload.max=78
git.ls_refs.count=2
git.ls_refs.head=refs/heads/master
fetchblob:none · deepen 10200287 KiB · hit2 ms
git.upload-pack fetch
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=fetch
git.upstream.dur_ms=151
git.response.bytes=293470
git.response.cache=HIT
git.response.duration_ms=2
git.fetch.filter=blob:none
git.fetch.filter.requested=tree:0
git.fetch.filter.fallback=blob:none
git.fetch.filter.learned=false
git.fetch.wants=31c911efe5652725e930f4d2e60c9060e5f6646d
git.fetch.haves.count=0
git.fetch.deepen=10
git.fetch.thin_pack=false
git.fetch.ofs_delta=true
git.protocol.version=2
git.pkt.frames=10
git.pkt.data=8
git.pkt.flush=1
git.pkt.delim=1
git.pkt.bytes=293470
git.pkt.payload.max=65516
git.sideband.band1.bytes=293354
git.sideband.band2.bytes=0
git.sideband.band3.bytes=0
git.pack.objects=87
git.pack.bytes=293354
git.pack.ofs_delta=0
git.pack.ref_delta=1
git.pack.chain.max=1
git.pack.trailer=6a646bcda6740bab42e321b51998b52ea15146c0
git.pack.full=86
Open pack map
fetch2001.6 KiB151 ms
git.upload-pack fetch
http.response.status_code=200
git.response.bytes=1626
git.response.cache=MISS
git.response.duration_ms=151
git.fetch.wants=827ba77ab60754f9bd6356849cd3d1dfeaf76fc9
git.fetch.haves.count=0
git.fetch.deepen=0
git.fetch.thin_pack=false
git.fetch.ofs_delta=true
git.protocol.version=2
git.pkt.frames=3
git.pkt.data=2
git.pkt.flush=1
git.pkt.delim=0
git.pkt.bytes=1626
git.pkt.payload.max=1605
git.sideband.band1.bytes=1604
git.sideband.band2.bytes=0
git.sideband.band3.bytes=0

Each row is one HTTP round trip ply made to the git server for this page, on one timeline. discover asks what the server speaks, ls-refs lists branch tips, fetch brings objects by id. A hit was served by Workers Cache. Tap a row for its wire details.

Remote
https://5ad2236b39de4c8bd8f6270ea63f3ea9.artifacts.cloudflare.net/git/public-v0/curl.git
Ref
refs/heads/master
Commit
31c911efe5652725e930f4d2e60c9060e5f6646d
cf-ray
a5e37f91b86b9318
Request
60b4fa15…
Protocol
v2 · sha1
Agent
gitty/1.0
Filter
advertised
Fetch
shallow filter sideband-all
Capabilities
agent ls-refs fetch object-format