Artifactspublic-v0

curl

master
ply4 git calls29 ms289 KiB3 cachedprotocol v2
202 lines8.0 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"
26#if defined(USE_GNUTLS) || defined(USE_SCHANNEL) || defined(USE_MBEDTLS) || \
27 defined(USE_RUSTLS)
28#include "vtls/x509asn1.h"
29#include "vtls/vtls.h"
31struct test_1666 {
32 const uint8_t *oid;
33 const size_t size;
34 const char *dotted;
35 CURLcode result_exp;
36};
38/* the size of the object needs to deduct the null-terminator */
39#define OID(x) (const uint8_t *)STRCONST(x)
41static bool test1666(const struct test_1666 *spec, size_t i,
42 struct dynbuf *dbuf)
44 CURLcode result;
45 const uint8_t *oid = spec->oid;
46 bool ok = TRUE;
48 curlx_dyn_reset(dbuf);
49 result = encodeOID(dbuf, oid, oid + spec->size);
50 if(result != spec->result_exp) {
51 curl_mfprintf(stderr, "test %zu: expect result %d, got %d\n",
52 i, (int)spec->result_exp, (int)result);
53 if(!spec->result_exp) {
54 curl_mfprintf(stderr, "test %zu: expected output '%s'\n",
55 i, spec->dotted);
56 }
57 ok = FALSE;
58 }
59 else if(!result && strcmp(spec->dotted, curlx_dyn_ptr(dbuf))) {
60 curl_mfprintf(stderr,
61 "test %zu: expected output '%s', got '%s'\n",
62 i, spec->dotted, curlx_dyn_ptr(dbuf));
63 ok = FALSE;
64 }
66 return ok;
69static CURLcode test_unit1666(const char *arg)
71 UNITTEST_BEGIN_SIMPLE
73 static const struct test_1666 test_specs[] = {
74 { OID(""), "", CURLE_BAD_FUNCTION_ARGUMENT },
75 { (const uint8_t *)"\x81", 0, "", CURLE_BAD_FUNCTION_ARGUMENT },
76 { OID("\x8F\xFF\xFF\xFF\x7F"), "2.4294967215", CURLE_OK },
77 { OID("\x90\x80\x80\x80\x00"), "", CURLE_BAD_FUNCTION_ARGUMENT },
78 { OID("\x88\x80\x80\x80\x4F"), "2.2147483647", CURLE_OK },
79 { OID("\x88\x80\x80\x80\x50"), "2.2147483648", CURLE_OK },
80 { OID("\x88\x80\x80\x80\x51"), "2.2147483649", CURLE_OK },
81 { OID("\x88\x80\x80\x80\x52"), "2.2147483650", CURLE_OK },
82 { OID("\x8F\xFF\xFF\xFF\x7F\x8F\xFF\xFF\xFF\x7F"),
83 "2.4294967215.4294967295", CURLE_OK },
84 { OID("\xB7\x28\x02"), "2.7000.2", CURLE_OK },
85 { OID("\x81\x00"), "2.48", CURLE_OK },
86 { OID("\x81\x00\x01"), "2.48.1", CURLE_OK },
87 { OID("\x81\x00\x02"), "2.48.2", CURLE_OK },
88 { OID("\xC0\x80\x81\x1F"), "2.134217807", CURLE_OK },
89 { OID("\x2b\x06\x01\x04\x01\x82\x37\x15\x14"), "1.3.6.1.4.1.311.21.20",
90 CURLE_OK },
91 { OID("\x2b\x06\x01\x04\x01\x82\x37\x15"), "1.3.6.1.4.1.311.21",
92 CURLE_OK },
93 { OID("\x2b\x06\x01\x04\x01\x82\x37"), "1.3.6.1.4.1.311", CURLE_OK },
94 { OID("\x2b\x06\x01\x04\x01"), "1.3.6.1.4.1", CURLE_OK },
95 { OID("\x2b\x06\x01\x04"), "1.3.6.1.4", CURLE_OK },
96 { OID("\x2b\x06\x01"), "1.3.6.1", CURLE_OK },
97 { OID("\x2b\x06"), "1.3.6", CURLE_OK },
98 { OID("\x2b"), "1.3", CURLE_OK },
99 { OID("\x2c"), "1.4", CURLE_OK },
100 { OID("\x2d"), "1.5", CURLE_OK },
101 { OID("\x2e"), "1.6", CURLE_OK },
102 { OID("\x2f"), "1.7", CURLE_OK },
103 { OID("\x30"), "1.8", CURLE_OK },
104 { OID("\x31"), "1.9", CURLE_OK },
105 { OID("\x32"), "1.10", CURLE_OK },
106 { OID("\x50"), "2.0", CURLE_OK },
107 { OID("\x7f"), "2.47", CURLE_OK },
108 { OID("\xff\x7f"), "2.16303", CURLE_OK },
109 { OID("\xff"), "", CURLE_BAD_FUNCTION_ARGUMENT },
110 { OID("\xff\x80\x01"), "2.2080689", CURLE_OK },
111 { OID("\xff\x80\x80\x01"), "2.266338225", CURLE_OK },
112 { OID("\x80\x80\x80\x80\x01"), "", CURLE_BAD_FUNCTION_ARGUMENT },
113 { OID("\x80\x80\x80\x80\x80\x01"), "", CURLE_BAD_FUNCTION_ARGUMENT },
114 { OID("\x80\x80\x80\x80\x80\x80\x01"), "", CURLE_BAD_FUNCTION_ARGUMENT },
115 { OID("\x80\xff\x7f"), "", CURLE_BAD_FUNCTION_ARGUMENT },
116 { OID("\x80\xff\xff\xff\x7f"), "", CURLE_BAD_FUNCTION_ARGUMENT },
117 { OID("\x2b\xff\xff\xff\xff\x7f"), "", CURLE_BAD_FUNCTION_ARGUMENT },
118 { OID("\x80\x80"), "", CURLE_BAD_FUNCTION_ARGUMENT },
119 { OID("\x80\x80\x80"), "", CURLE_BAD_FUNCTION_ARGUMENT },
120 { OID("\x80\x80\x80\x80"), "", CURLE_BAD_FUNCTION_ARGUMENT },
121 { OID("\x80\x80\x80\x80\x80"), "", CURLE_BAD_FUNCTION_ARGUMENT },
122 { OID("\x80\x80\x80\x80\x80\x80"), "", CURLE_BAD_FUNCTION_ARGUMENT },
123 { OID("\x2b\x06\x01\x04\x01\xee"), "", CURLE_BAD_FUNCTION_ARGUMENT },
124 { OID("\x00"), "0.0", CURLE_OK },
125 { OID("\x01"), "0.1", CURLE_OK },
126 { OID("\x02"), "0.2", CURLE_OK },
127 { OID("\x03"), "0.3", CURLE_OK },
128 { OID("\x04"), "0.4", CURLE_OK },
129 { OID("\x05"), "0.5", CURLE_OK },
130 { OID("\x2b\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01"
131 "\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01"
132 "\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01"),
133 "1.3.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1"
134 ".1.1.1.1.1.1.1.1", CURLE_OK },
135 { OID("\x2b\x64\x64\x64\x64\x64\x64\x64\x64\x64\x64\x64\x64\x64\x64\x64"
136 "\x64\x64\x64\x64\x64\x64\x64\x64\x64\x7f"),
137 "", CURLE_TOO_LARGE },
138 { OID("\x2b\x64\x64\x64\x64\x64\x64\x64\x64\x64\x64\x64\x64\x64\x64\x64"
139 "\x64\x64\x64\x64\x64\x64\x64\x64\x64\x63"),
140 "", CURLE_TOO_LARGE },
141 { OID("\x2b\x64\x64\x64\x64\x64\x64\x64\x64\x64\x64\x64\x64\x64\x64\x64"
142 "\x64\x64\x64\x64\x64\x64\x64\x64\x64\x09"),
143 "", CURLE_TOO_LARGE },
144 { OID("\x2b\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01"
145 "\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01"
146 "\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01"
147 "\x01\x01\x01\x01\x01\x01\x01\x01"),
148 "", CURLE_TOO_LARGE },
149 /* one byte shorter than the previous is below the limit: */
150 { OID("\x2b\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01"
151 "\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01"
152 "\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01"
153 "\x01\x01\x01\x01\x01\x01\x01"),
154 "1.3.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1"
155 ".1.1.1.1.1.1.1.1.1.1.1.1.1.1.1", CURLE_OK },
156 { OID("\x78"), "2.40", CURLE_OK },
157 { OID("\x81\x34"), "2.100", CURLE_OK },
158 { OID("\x2b\x00\x01"), "1.3.0.1", CURLE_OK },
159 { OID("\x2b\x06\x01\x00"), "1.3.6.1.0", CURLE_OK },
160 { OID("\x2b\x8f\xff\xff\xff\x7f"), "1.3.4294967295", CURLE_OK },
161 { OID("\x2b\x81\x00"), "1.3.128", CURLE_OK },
162 { OID("\x2b\x80\x05"), "", CURLE_BAD_FUNCTION_ARGUMENT },
163 { OID("\x2b\x80\x80\x01"), "", CURLE_BAD_FUNCTION_ARGUMENT },
164 { OID("\x2b\x06\x81"), "", CURLE_BAD_FUNCTION_ARGUMENT },
165 };
167 size_t i;
168 struct dynbuf dbuf;
169 bool all_ok = TRUE;
171 if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
172 curl_mfprintf(stderr, "curl_global_init() failed\n");
173 return TEST_ERR_MAJOR_BAD;
174 }
176 /* the real code uses CURL_X509_STR_MAX for maximum size, but we set a
177 smaller one here so that we can test running into the limit a little
178 easier */
179 curlx_dyn_init(&dbuf, 100);
181 for(i = 0; i < CURL_ARRAYSIZE(test_specs); ++i) {
182 if(!test1666(&test_specs[i], i, &dbuf))
183 all_ok = FALSE;
184 }
185 fail_unless(all_ok, "some tests of encodeOID() failed");
187 curlx_dyn_free(&dbuf);
188 curl_global_cleanup();
190 UNITTEST_END_SIMPLE
193#else
195static CURLcode test_unit1666(const char *arg)
197 UNITTEST_BEGIN_SIMPLE
198 puts("not tested since encodeOID() is not built in");
199 UNITTEST_END_SIMPLE
202#endif
Diagnostics4 git calls · 29 ms
CallStatusSizeTime029 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 · 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 · hit3 ms
git.upload-pack fetch
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=fetch
git.upstream.dur_ms=23
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
fetch2002.2 KiB · hit23 ms
git.upload-pack fetch
http.response.status_code=200
git.response.bytes=2230
git.response.cache=HIT
git.response.duration_ms=23
git.fetch.wants=28e53c09c872c9ff4e0a1ec10361e32cdfd7d967
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=2230
git.pkt.payload.max=2209
git.sideband.band1.bytes=2208
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
a5e2e9ac5a864bc2
Request
132cfb1c…
Protocol
v2 · sha1
Agent
gitty/1.0
Filter
advertised
Fetch
shallow filter sideband-all
Capabilities
agent ls-refs fetch object-format