Artifactspublic-v0

curl

master
ply4 git calls178 ms289 KiB2 cachedprotocol v2
273 lines6.6 KiBRaw
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#include "curl_setup.h"
26#include "llist.h"
28#ifdef DEBUGBUILD
29#define LLISTINIT 0x100cc001 /* random pattern */
30#define NODEINIT 0x12344321 /* random pattern */
31#define NODEREM 0x54321012 /* random pattern */
33#define VERIFYNODE(x) verifynode(x)
34static struct Curl_llist_node *verifynode(struct Curl_llist_node *n)
36 DEBUGASSERT(!n || (n->_init == NODEINIT));
37 return n;
39#else
40#define VERIFYNODE(x) x
41#endif
42/*
43 * @unittest 1300
44 */
45void Curl_llist_init(struct Curl_llist *l, Curl_llist_dtor dtor)
47 l->_size = 0;
48 l->_dtor = dtor;
49 l->_head = NULL;
50 l->_tail = NULL;
51#ifdef DEBUGBUILD
52 l->_init = LLISTINIT;
53#endif
56/*
57 * llist_insert_next()
58 *
59 * Inserts a new list element after the given one 'e'. If the given existing
60 * entry is NULL and the list already has elements, the new one will be
61 * inserted first in the list.
62 *
63 * The 'ne' argument should be a pointer into the object to store.
64 *
65 * @unittest 1300
66 */
67UNITTEST void llist_insert_next(struct Curl_llist *list,
68 struct Curl_llist_node *e, const void *p,
69 struct Curl_llist_node *ne);
70UNITTEST void llist_insert_next(struct Curl_llist *list,
71 struct Curl_llist_node *e, /* may be NULL */
72 const void *p,
73 struct Curl_llist_node *ne)
75 DEBUGASSERT(list);
76 DEBUGASSERT(list->_init == LLISTINIT);
77 DEBUGASSERT(ne);
79#ifdef DEBUGBUILD
80 ne->_init = NODEINIT;
81#endif
82 ne->_ptr = CURL_UNCONST(p);
83 ne->_list = list;
84 if(list->_size == 0) {
85 list->_head = ne;
86 list->_head->_prev = NULL;
87 list->_head->_next = NULL;
88 list->_tail = ne;
89 }
90 else {
91 /* if 'e' is NULL here, we insert the new element first in the list */
92 ne->_next = e ? e->_next : list->_head;
93 ne->_prev = e;
94 if(!e) {
95 list->_head->_prev = ne;
96 list->_head = ne;
97 }
98 else if(e->_next) {
99 e->_next->_prev = ne;
100 }
101 else {
102 list->_tail = ne;
103 }
104 if(e)
105 e->_next = ne;
106 }
108 ++list->_size;
111/*
112 * Curl_llist_append()
113 *
114 * Adds a new list element to the end of the list.
115 *
116 * The 'ne' argument should be a pointer into the object to store.
117 *
118 * @unittest 1300
119 */
120void Curl_llist_append(struct Curl_llist *list, const void *p,
121 struct Curl_llist_node *ne)
123 DEBUGASSERT(list);
124 DEBUGASSERT(list->_init == LLISTINIT);
125 DEBUGASSERT(ne);
126 llist_insert_next(list, list->_tail, p, ne);
129void *Curl_node_take_elem(struct Curl_llist_node *e)
131 void *ptr;
132 struct Curl_llist *list;
133 if(!e)
134 return NULL;
136 list = e->_list;
137 DEBUGASSERT(list);
138 DEBUGASSERT(list->_init == LLISTINIT);
139 DEBUGASSERT(list->_size);
140 DEBUGASSERT(e->_init == NODEINIT);
141 if(list) {
142 if(e == list->_head) {
143 list->_head = e->_next;
145 if(!list->_head)
146 list->_tail = NULL;
147 else
148 e->_next->_prev = NULL;
149 }
150 else {
151 if(e->_prev)
152 e->_prev->_next = e->_next;
154 if(!e->_next)
155 list->_tail = e->_prev;
156 else
157 e->_next->_prev = e->_prev;
158 }
159 --list->_size;
160 }
161 ptr = e->_ptr;
163 e->_list = NULL;
164 e->_ptr = NULL;
165 e->_prev = NULL;
166 e->_next = NULL;
167#ifdef DEBUGBUILD
168 e->_init = NODEREM; /* specific pattern on remove - not zero */
169#endif
171 return ptr;
174static void node_uremove(struct Curl_llist_node *e, void *user)
176 struct Curl_llist *list;
177 void *ptr;
178 if(!e)
179 return;
181 list = e->_list;
182 DEBUGASSERT(list);
183 if(list) {
184 ptr = Curl_node_take_elem(e);
185 if(list->_dtor)
186 list->_dtor(user, ptr);
187 }
190void Curl_node_remove(struct Curl_llist_node *e)
192 node_uremove(e, NULL);
195void Curl_llist_destroy(struct Curl_llist *list, void *user)
197 if(list) {
198 DEBUGASSERT(list->_init == LLISTINIT);
199 while(list->_size > 0)
200 node_uremove(list->_tail, user);
201 }
204/* Curl_llist_head() returns the first 'struct Curl_llist_node *', which
205 might be NULL */
206struct Curl_llist_node *Curl_llist_head(const struct Curl_llist *list)
208 DEBUGASSERT(list);
209 DEBUGASSERT(list->_init == LLISTINIT);
210 return VERIFYNODE(list->_head);
213#ifdef UNITTESTS
214/* llist_tail() returns the last 'struct Curl_llist_node *', which might be
215 NULL
217 @unittest 1300 */
218UNITTEST struct Curl_llist_node *llist_tail(const struct Curl_llist *list);
219UNITTEST struct Curl_llist_node *llist_tail(const struct Curl_llist *list)
221 DEBUGASSERT(list);
222 DEBUGASSERT(list->_init == LLISTINIT);
223 return VERIFYNODE(list->_tail);
225#endif
227/* Curl_llist_count() returns a size_t the number of nodes in the list */
228size_t Curl_llist_count(const struct Curl_llist *list)
230 DEBUGASSERT(list);
231 DEBUGASSERT(list->_init == LLISTINIT);
232 return list->_size;
235/* Curl_node_elem() returns the custom data from a Curl_llist_node */
236void *Curl_node_elem(const struct Curl_llist_node *n)
238 DEBUGASSERT(n);
239 DEBUGASSERT(n->_init == NODEINIT);
240 return n->_ptr;
243/* Curl_node_next() returns the next element in a list from a given
244 Curl_llist_node */
245struct Curl_llist_node *Curl_node_next(const struct Curl_llist_node *n)
247 DEBUGASSERT(n);
248 DEBUGASSERT(n->_init == NODEINIT);
249 return VERIFYNODE(n->_next);
252#ifdef UNITTESTS
253/* llist_node_prev() returns the previous element in a list from a given
254 Curl_llist_node
256 @unittest 1300 */
257UNITTEST struct Curl_llist_node *llist_node_prev(
258 const struct Curl_llist_node *n);
259UNITTEST struct Curl_llist_node *llist_node_prev(
260 const struct Curl_llist_node *n)
262 DEBUGASSERT(n);
263 DEBUGASSERT(n->_init == NODEINIT);
264 return VERIFYNODE(n->_prev);
266#endif
268struct Curl_llist *Curl_node_llist(const struct Curl_llist_node *n)
270 DEBUGASSERT(n);
271 DEBUGASSERT(!n->_list || n->_init == NODEINIT);
272 return n->_list;
Diagnostics4 git calls · 178 ms
CallStatusSizeTime0178 ms
discover200152 B3 ms
git.upload-pack discover
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=ls-refs
git.upstream.dur_ms=3
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 · hit5 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 · hit4 ms
git.upload-pack fetch
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=fetch
git.upstream.dur_ms=3
git.response.bytes=293470
git.response.cache=HIT
git.response.duration_ms=4
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
fetch2002.0 KiB169 ms
git.upload-pack fetch
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=fetch
git.upstream.dur_ms=169
git.response.bytes=2034
git.response.cache=MISS
git.response.duration_ms=169
git.fetch.wants=516b15673b9c75af6ba0055d3d8ad8de06660554
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=2034
git.pkt.payload.max=2013
git.sideband.band1.bytes=2012
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
a5e2d42aec92689d
Request
ff3b31d9…
Protocol
v2 · sha1
Agent
gitty/1.0
Filter
advertised
Fetch
shallow filter sideband-all
Capabilities
agent ls-refs fetch object-format