Artifactspublic-v0

curl

master
ply4 git calls161 ms289 KiB2 cachedprotocol v2
142 lines5.5 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"
25#include "urldata.h"
26#include "dynhds.h"
27#include "curl_trc.h"
29static CURLcode test_unit2602(const char *arg)
31 UNITTEST_BEGIN_SIMPLE
33 struct dynhds hds;
34 struct dynbuf dbuf;
35 CURLcode result;
36 size_t i;
37 size_t nentries;
39 /* add 1 more header than allowed */
40 Curl_dynhds_init(&hds, 2, 128);
41 fail_if(Curl_dynhds_count(&hds), "should be empty");
42 fail_if(Curl_dynhds_add(&hds, "test1", 5, "123", 3), "add failed");
43 fail_if(Curl_dynhds_add(&hds, "test2", 5, "456", 3), "add failed");
44 /* remove and add without exceeding limits */
45 for(i = 0; i < 100; ++i) {
46 if(dynhds_remove(&hds, "test2", 5) != 1) {
47 fail_if(TRUE, "should");
48 break;
49 }
50 if(Curl_dynhds_add(&hds, "test2", 5, "456", 3)) {
51 fail_if(TRUE, "add failed");
52 break;
53 }
54 }
55 fail_unless(Curl_dynhds_count(&hds) == 2, "should hold 2");
56 /* set, replacing previous entry without exceeding limits */
57 for(i = 0; i < 100; ++i) {
58 if(dynhds_set(&hds, "test2", 5, "456", 3)) {
59 fail_if(TRUE, "add failed");
60 break;
61 }
62 }
63 fail_unless(Curl_dynhds_count(&hds) == 2, "should hold 2");
64 /* exceed limit on # of entries */
65 result = Curl_dynhds_add(&hds, "test3", 5, "789", 3);
66 fail_unless(result, "add should have failed");
68 fail_unless(dynhds_count_name(&hds, "test", 4) == 0, "false positive");
69 fail_unless(dynhds_count_name(&hds, "test1", 4) == 0, "false positive");
70 fail_if(Curl_dynhds_get(&hds, "test1", 4), "false positive");
71 fail_unless(Curl_dynhds_get(&hds, "test1", 5), "false negative");
72 fail_unless(dynhds_count_name(&hds, "test1", 5) == 1, "should");
73 fail_unless(dynhds_ccount_name(&hds, "test2") == 1, "should");
74 fail_unless(Curl_dynhds_cget(&hds, "test2"), "should");
75 fail_unless(dynhds_ccount_name(&hds, "TEST2") == 1, "should");
76 fail_unless(dynhds_ccontains(&hds, "TesT2"), "should");
77 fail_unless(dynhds_contains(&hds, "TeSt2", 5), "should");
79 /* Check overflow detection */
80 fail_unless(Curl_dynhds_add(&hds, "test1", SIZE_MAX / 2,
81 "123", SIZE_MAX / 2), "overflow check failed");
82 Curl_dynhds_free(&hds);
84 /* add header exceeding max overall length */
85 Curl_dynhds_init(&hds, 128, 10);
86 fail_if(Curl_dynhds_add(&hds, "test1", 5, "123", 3), "add failed");
87 fail_unless(Curl_dynhds_add(&hds, "test2", 5, "456", 3), "should fail");
88 fail_if(Curl_dynhds_add(&hds, "t", 1, "1", 1), "add failed");
89 Curl_dynhds_reset(&hds);
90 Curl_dynhds_free(&hds);
92 Curl_dynhds_init(&hds, 128, 4 * 1024);
93 fail_if(Curl_dynhds_add(&hds, "test1", 5, "123", 3), "add failed");
94 fail_if(Curl_dynhds_add(&hds, "test1", 5, "123", 3), "add failed");
95 fail_if(Curl_dynhds_add(&hds, "test2", 5, NULL, 0), "add failed");
96 fail_if(Curl_dynhds_cadd(&hds, "test2", NULL), "add failed");
97 fail_unless(dynhds_ccontains(&hds, "test2"), "should");
98 fail_unless(dynhds_ccount_name(&hds, "test2") == 2, "should");
99 fail_if(Curl_dynhds_cadd(&hds, "blablabla", "thingies"), "add failed");
100 fail_if(Curl_dynhds_h1_cadd_line(&hds, "blablabla: thingies"), "add failed");
101 fail_unless(dynhds_ccount_name(&hds, "blablabla") == 2, "should");
102 fail_unless(dynhds_cremove(&hds, "blablabla") == 2, "should");
103 fail_if(dynhds_ccontains(&hds, "blablabla"), "should not");
105 result = Curl_dynhds_h1_cadd_line(&hds, "blablabla thingies");
106 fail_unless(result, "add should have failed");
107 nentries = Curl_dynhds_count(&hds);
108 result = Curl_dynhds_h1_cadd_line(&hds, ": thingies");
109 fail_unless(result == CURLE_BAD_FUNCTION_ARGUMENT,
110 "empty name should have failed");
111 fail_unless(Curl_dynhds_count(&hds) == nentries,
112 "empty name should not have been added");
113 if(!result) {
114 fail_unless(dynhds_ccount_name(&hds, "bLABlaBlA") == 0, "should");
115 fail_if(Curl_dynhds_cadd(&hds, "Bla-Bla", "thingies"), "add failed");
117 curlx_dyn_init(&dbuf, 32 * 1024);
118 fail_if(Curl_dynhds_h1_dprint(&hds, &dbuf), "h1 print failed");
119 if(curlx_dyn_ptr(&dbuf)) {
120 fail_if(strcmp(curlx_dyn_ptr(&dbuf),
121 "test1: 123\r\ntest1: 123\r\nBla-Bla: thingies\r\n"),
122 "h1 format differs");
123 }
124 curlx_dyn_free(&dbuf);
125 }
127 Curl_dynhds_free(&hds);
129 curlx_dyn_init(&dbuf, 32 * 1024);
130 fail_if(Curl_dynhds_h1_dprint(&hds, &dbuf), "h1 print failed");
131 if(curlx_dyn_ptr(&dbuf)) {
132 curl_mfprintf(stderr, "indent concat: %s\n", curlx_dyn_ptr(&dbuf));
133 fail_if(strcmp(curlx_dyn_ptr(&dbuf),
134 "ti1: val1 val2\r\nti2: val1 val2\r\nti3: val1 val2\r\n"),
135 "wrong format");
136 }
137 curlx_dyn_free(&dbuf);
139 Curl_dynhds_free(&hds);
141 UNITTEST_END_SIMPLE
Diagnostics4 git calls · 161 ms
CallStatusSizeTime0161 ms
discover200152 B2 ms
git.upload-pack discover
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=ls-refs
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 · hit3 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=3
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.7 KiB156 ms
git.upload-pack fetch
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=fetch
git.upstream.dur_ms=156
git.response.bytes=1740
git.response.cache=MISS
git.response.duration_ms=156
git.fetch.wants=22f158d6b83104a138d91569652bcb8a54fe1468
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=1740
git.pkt.payload.max=1719
git.sideband.band1.bytes=1718
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
a5e2d233ce31cf3a
Request
79d9dad4…
Protocol
v2 · sha1
Agent
gitty/1.0
Filter
advertised
Fetch
shallow filter sideband-all
Capabilities
agent ls-refs fetch object-format