Artifactspublic-v0

curl

master
ply4 git calls764 ms289 KiB2 cachedprotocol v2
470 lines12 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 "unitcheck.h"
26static CURLcode t1664_setup(void)
28 CURLcode result = CURLE_OK;
29 global_init(CURL_GLOBAL_ALL);
30 return result;
33static CURLcode test_unit1664(const char *arg)
35 UNITTEST_BEGIN(t1664_setup())
37 static const char * const wordparse[] = {
38 "word",
39 "word ",
40 " word ",
41 "wo rd",
42 "word(",
43 "wor(d",
44 "perfect",
45 "",
46 "longerth",
47 NULL
48 };
50 int i;
51 curl_mprintf("curlx_str_word\n");
52 for(i = 0; wordparse[i]; i++) {
53 struct Curl_str out;
54 const char *line = wordparse[i];
55 const char *orgline = line;
56 int rc = curlx_str_word(&line, &out, 7);
57 curl_mprintf("%d: (\"%s\") %d, \"%.*s\" [%d], line %d\n",
58 i, orgline, rc, (int)out.len, out.str, (int)out.len,
59 (int)(line - orgline));
60 }
62 curl_mprintf("curlx_str_until\n");
63 for(i = 0; wordparse[i]; i++) {
64 struct Curl_str out;
65 const char *line = wordparse[i];
66 const char *orgline = line;
67 int rc = curlx_str_until(&line, &out, 7, 'd');
68 curl_mprintf("%d: (\"%s\") %d, \"%.*s\" [%d], line %d\n",
69 i, orgline, rc, (int)out.len, out.str, (int)out.len,
70 (int)(line - orgline));
71 }
73 {
74 static const char * const qwords[] = {
75 "\"word\"",
76 "\"word",
77 "word\"",
78 "\"word\"\"",
79 "\"word\" ",
80 " \"word\"",
81 "\"perfect\"",
82 "\"p r e t\"",
83 "\"perfec\\\"",
84 "\"trail\\\"\"",
85 "\"trail2\\\"\"",
86 "\"trail33\\\"\"",
87 "\"0\\\\\\\\\\\\\"",
88 "\"1\\\\\\\\\\\\\\\"",
89 "\"\"",
90 "",
91 "\"longerth\"",
92 NULL
93 };
95 curl_mprintf("curlx_str_quotedword\n");
96 for(i = 0; qwords[i]; i++) {
97 struct Curl_str out;
98 const char *line = qwords[i];
99 const char *orgline = line;
100 int rc = curlx_str_quotedword(&line, &out, 7);
101 curl_mprintf("%d: (\"%s\") %d, \"%.*s\" [%d], line %d\n",
102 i, orgline, rc, (int)out.len, out.str, (int)out.len,
103 (int)(line - orgline));
104 }
105 }
107 {
108 static const char * const single[] = {
109 "a",
110 "aa",
111 "A",
112 "b",
113 "\\",
114 " ",
115 "",
116 NULL
117 };
118 curl_mprintf("curlx_str_single\n");
119 for(i = 0; single[i]; i++) {
120 const char *line = single[i];
121 const char *orgline = line;
122 int rc = curlx_str_single(&line, 'a');
123 curl_mprintf("%d: (\"%s\") %d, line %d\n",
124 i, orgline, rc, (int)(line - orgline));
125 }
126 }
128 {
129 static const char * const single[] = {
130 "a",
131 "aa",
132 "A",
133 "b",
134 "\\",
135 " ",
136 "\t",
137 "\n",
138 "",
139 NULL
140 };
141 curl_mprintf("curlx_str_singlespace\n");
142 for(i = 0; single[i]; i++) {
143 const char *line = single[i];
144 const char *orgline = line;
145 int rc = curlx_str_singlespace(&line);
146 curl_mprintf("%d: (\"%s\") %d, line %d\n",
147 i, orgline, rc, (int)(line - orgline));
148 }
149 }
151 {
152 static const char * const nums[] = {
153 "1",
154 "10000",
155 "1234",
156 "1235",
157 "1236",
158 "01234",
159 "00000000000000000000000000001234",
160 "0123 345",
161 "0123O345",
162 "-12",
163 " 123",
164 "",
165 NULL
166 };
167 curl_mprintf("curlx_str_number\n");
168 for(i = 0; nums[i]; i++) {
169 curl_off_t num;
170 const char *line = nums[i];
171 const char *orgline = line;
172 int rc = curlx_str_number(&line, &num, 1235);
173 curl_mprintf("%d: (\"%s\") %d, [%" CURL_FORMAT_CURL_OFF_T "] line %d\n",
174 i, orgline, rc, num, (int)(line - orgline));
175 }
176 }
178 {
179 struct t {
180 const char *str;
181 curl_off_t max;
182 };
183 static struct t nums[] = {
184 { "00", 8},
185 { "1", 8},
186 { "1", 1},
187 { "2", 1},
188 { "2", 2},
189 { "5", 6},
190 { "000000000000000000000006", 6},
191 { "7", 6},
192 { "8", 6},
193 { "9", 8},
194 { "10", 10},
195 { "11", 10},
196 { "12", 10},
197 {NULL, 0}
198 };
199 curl_mprintf("curlx_str_number varying max\n");
200 for(i = 0; nums[i].str; i++) {
201 curl_off_t num;
202 const char *line = nums[i].str;
203 const char *orgline = line;
204 int rc = curlx_str_number(&line, &num, nums[i].max);
205 curl_mprintf("%d: (\"%s\") max %" CURL_FORMAT_CURL_OFF_T
206 " == %d, [%" CURL_FORMAT_CURL_OFF_T "]\n",
207 i, orgline, nums[i].max, rc, num);
208 }
209 }
211 {
212 struct t {
213 const char *str;
214 curl_off_t max;
215 };
216 static struct t nums[] = {
217 { "00", 8},
218 { "1", 8},
219 { "1", 1},
220 { "2", 1},
221 { "2", 2},
222 { "5", 6},
223 { "000000000000000000000006", 6},
224 { "7", 6},
225 { "8", 6},
226 { "9", 8},
227 { "a", 14},
228 { "b", 14},
229 { "c", 14},
230 { "d", 14},
231 { "e", 14},
232 { "f", 14},
233 { "f", 15},
234 { "10", 16},
235 { "11", 16},
236 { "12", 16},
237 {NULL, 0}
238 };
239 curl_mprintf("curlx_str_hex varying max\n");
240 for(i = 0; nums[i].str; i++) {
241 curl_off_t num;
242 const char *line = nums[i].str;
243 const char *orgline = line;
244 int rc = curlx_str_hex(&line, &num, nums[i].max);
245 curl_mprintf("%d: (\"%s\") max %" CURL_FORMAT_CURL_OFF_T
246 " == %d, [%" CURL_FORMAT_CURL_OFF_T "]\n",
247 i, orgline, nums[i].max, rc, num);
248 }
249 }
251 {
252 struct t {
253 const char *str;
254 curl_off_t max;
255 };
256 static struct t nums[] = {
257 { "00", 4},
258 { "1", 4},
259 { "1", 4},
260 { "2", 4},
261 { "3", 4},
262 { "4", 4},
263 { "5", 4},
264 { "000000000000000000000006", 6},
265 { "7", 7},
266 { "10", 8},
267 { "11", 8},
268 { "11", 9},
269 { "12", 9},
270 { "13", 9},
271 { "8", 10},
272 {NULL, 0}
273 };
274 curl_mprintf("curlx_str_octal varying max\n");
275 for(i = 0; nums[i].str; i++) {
276 curl_off_t num;
277 const char *line = nums[i].str;
278 const char *orgline = line;
279 int rc = curlx_str_octal(&line, &num, nums[i].max);
280 curl_mprintf("%d: (\"%s\") max %" CURL_FORMAT_CURL_OFF_T
281 " == %d, [%" CURL_FORMAT_CURL_OFF_T "]\n",
282 i, orgline, nums[i].max, rc, num);
283 }
284 }
286 {
287 /* CURL_OFF_T is typically 9223372036854775807 */
288 static const char * const nums[] = {
289 "9223372036854775807", /* 2^63 -1 */
290 "9223372036854775808", /* 2^63 */
291 "18446744073709551615", /* 2^64 - 1 */
292 "18446744073709551616", /* 2^64 */
293 "18446744073709551617", /* 2^64 + 1 */
294 "0123456799a",
295 "0123456789",
296 "123498760b",
297 "1234987607611298232",
298 "1111111111111111111",
299 "2222222222222222222",
300 "00000000000000000000000000000009223372036854775807",
301 "3333333333333333333",
302 "4444444444444444444",
303 "5555555555555555555",
304 "6666666666666666666",
305 "7777777777777777777",
306 "8888888888888888888",
307 "999999999999999999",
308 NULL
309 };
310 curl_mprintf("curlx_str_number / max\n");
311 for(i = 0; nums[i]; i++) {
312 curl_off_t num;
313 const char *line = nums[i];
314 const char *orgline = line;
315 int rc = curlx_str_number(&line, &num, CURL_OFF_T_MAX);
316 curl_mprintf("%d: (\"%s\") %d, [%" CURL_FORMAT_CURL_OFF_T "] line %d\n",
317 i, orgline, rc, num, (int)(line - orgline));
318 }
319 }
321 {
322 static const char * const newl[] = {
323 "a",
324 "aa",
325 "A",
326 "b",
327 "\\",
328 " ",
329 "\n",
330 "\r",
331 "\r\n",
332 "\x0c",
333 "",
334 NULL
335 };
336 curl_mprintf("curlx_str_newline\n");
337 for(i = 0; newl[i]; i++) {
338 const char *line = newl[i];
339 const char *orgline = line;
340 int rc = curlx_str_newline(&line);
341 curl_mprintf("%d: (%%%02x) %d, line %d\n",
342/* Workaround for the expression erroneously returning the byte from the next
343 address for inputs \n, \r and \r\n. Thus returning NUL, NUL, \n instead of
344 the expected \n, \r, \r. */
345#if defined(_MSC_VER) && _MSC_VER >= 1923 && _MSC_VER <= 1934 && \
346 defined(_WIN64)
347 i, (unsigned int)newl[i][0],
348#else
349 i, (unsigned int)*orgline,
350#endif
351 rc, (int)(line - orgline));
352 }
353 }
355 {
356 static const char * const nums[] = {
357 "1",
358 "1000",
359 "1234",
360 "1235",
361 "1236",
362 "01234",
363 "00000000000000000000000000001234",
364 "0123 345",
365 "0123O345",
366 "-12",
367 " 123",
368 "",
369 NULL
370 };
371 curl_mprintf("curlx_str_hex\n");
372 for(i = 0; nums[i]; i++) {
373 curl_off_t num;
374 const char *line = nums[i];
375 const char *orgline = line;
376 int rc = curlx_str_hex(&line, &num, 0x1235);
377 curl_mprintf("%d: (\"%s\") %d, [%" CURL_FORMAT_CURL_OFF_T "] line %d\n",
378 i, orgline, rc, num, (int)(line - orgline));
379 }
380 }
382 {
383 static const char * const nums[] = {
384 "1",
385 "1000",
386 "1234",
387 "1235",
388 "1236",
389 "01234",
390 "00000000000000000000000000001234",
391 "0123 345",
392 "0123O345",
393 "-12",
394 " 123",
395 "",
396 NULL
397 };
398 curl_mprintf("curlx_str_octal\n");
399 for(i = 0; nums[i]; i++) {
400 curl_off_t num;
401 const char *line = nums[i];
402 const char *orgline = line;
403 int rc = curlx_str_octal(&line, &num, 01235);
404 curl_mprintf("%d: (\"%s\") %d, [%" CURL_FORMAT_CURL_OFF_T "] line %d\n",
405 i, orgline, rc, num, (int)(line - orgline));
406 }
407 }
409 {
410 /* CURL_OFF_T is typically 2^63-1 */
411 static const char * const nums[] = {
412 "777777777777777777777", /* 2^63 -1 */
413 "1000000000000000000000", /* 2^63 */
414 "111111111111111111111",
415 "222222222222222222222",
416 "333333333333333333333",
417 "444444444444444444444",
418 "555555555555555555555",
419 "666666666666666666666",
420 NULL
421 };
422 curl_mprintf("curlx_str_octal / max\n");
423 for(i = 0; nums[i]; i++) {
424 curl_off_t num;
425 const char *line = nums[i];
426 const char *orgline = line;
427 int rc = curlx_str_octal(&line, &num, CURL_OFF_T_MAX);
428 curl_mprintf("%d: (\"%s\") %d, [%" CURL_FORMAT_CURL_OFF_T "] line %d\n",
429 i, orgline, rc, num, (int)(line - orgline));
430 }
431 }
433 {
434 /* CURL_OFF_T is typically 2^63-1 */
435 static const char * const nums[] = {
436 "7FFFFFFFFFFFFFFF", /* 2^63 -1 */
437 "8000000000000000", /* 2^63 */
438 "1111111111111111",
439 "2222222222222222",
440 "3333333333333333",
441 "4444444444444444",
442 "5555555555555555",
443 "6666666666666666",
444 "7777777777777777",
445 "888888888888888",
446 "999999999999999",
447 "aaaaaaaaAAAAAAA",
448 "bbbbbbbbBBBBBBB",
449 "BBBBBBBBbbbbbbb",
450 "ccccccccCCCCCCC",
451 "ddddddddDDDDDDD",
452 "eeeeeeeeEEEEEEE",
453 "ffffffffFFFFFFF",
454 "abcdef",
455 "ABCDEF",
456 NULL
457 };
458 curl_mprintf("curlx_str_hex / max\n");
459 for(i = 0; nums[i]; i++) {
460 curl_off_t num;
461 const char *line = nums[i];
462 const char *orgline = line;
463 int rc = curlx_str_hex(&line, &num, CURL_OFF_T_MAX);
464 curl_mprintf("%d: (\"%s\") %d, [%" CURL_FORMAT_CURL_OFF_T "] line %d\n",
465 i, orgline, rc, num, (int)(line - orgline));
466 }
467 }
469 UNITTEST_END(curl_global_cleanup())
Diagnostics4 git calls · 764 ms
CallStatusSizeTime0764 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 · hit3 ms
git.upload-pack ls-refs
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=ls-refs
git.upstream.dur_ms=3
git.response.bytes=149
git.response.cache=HIT
git.response.duration_ms=3
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 · hit25 ms
git.upload-pack fetch
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=fetch
git.upstream.dur_ms=2
git.response.bytes=293470
git.response.cache=HIT
git.response.duration_ms=25
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.4 KiB736 ms
git.upload-pack fetch
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=fetch
git.upstream.dur_ms=736
git.response.bytes=2470
git.response.cache=MISS
git.response.duration_ms=736
git.fetch.wants=66bf66ee15c906b7742b280367d5e8fb2dead222
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=2470
git.pkt.payload.max=2449
git.sideband.band1.bytes=2448
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
a5e1ff140fd1a9c0
Request
6ece6e3a…
Protocol
v2 · sha1
Agent
gitty/1.0
Filter
advertised
Fetch
shallow filter sideband-all
Capabilities
agent ls-refs fetch object-format