Artifactspublic-v0

curl

master
ply4 git calls121 ms289 KiB2 cachedprotocol v2
159 lines4.8 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 t1396_setup(void)
28 CURLcode result = CURLE_OK;
29 global_init(CURL_GLOBAL_ALL);
30 return result;
33static void t1396_stop(CURL *easy)
35 if(easy)
36 curl_easy_cleanup(easy);
37 curl_global_cleanup();
40static CURLcode test_lib1396(const char *arg)
42 CURL *easy;
44 UNITTEST_BEGIN(t1396_setup())
46 struct test {
47 const char *in;
48 int inlen;
49 const char *out;
50 int outlen;
51 };
53 /* unescape, this => that */
54 static const struct test list1[] = {
55 { "%61", 3, "a", 1 },
56 { "%61a", 4, "aa", 2 },
57 { "%61b", 4, "ab", 2 },
58 { "%6 1", 4, "%6 1", 4 },
59 { "%61", 1, "%", 1 },
60 { "%61", 2, "%6", 2 },
61 { "%6%a", 4, "%6%a", 4 },
62 { "%6a", 0, "j", 1 },
63 { "%FF", 0, "\xff", 1 },
64 { "%FF%00%ff", 9, "\xff\x00\xff", 3 },
65 { "%-2", 0, "%-2", 3 },
66 { "%FG", 0, "%FG", 3 },
67 { NULL, 0, NULL, 0 } /* end of list marker */
68 };
69 /* escape, this => that */
70 static const struct test list2[] = {
71 { "a", 1, "a", 1 },
72 { "-", 1, "-", 1 },
73 { ".", 1, ".", 1 },
74 { "_", 1, "_", 1 },
75 { "~", 1, "~", 1 },
76 { "/", 1, "%2F", 3 },
77 { "a=b", 3, "a%3Db", 5 },
78 { "a=b", 0, "a%3Db", 5 },
79 { "a=b", 1, "a", 1 },
80 { "a=b", 2, "a%3D", 4 },
81 { "1/./0", 5, "1%2F.%2F0", 9 },
82 { "-._~!#%&", 0, "-._~%21%23%25%26", 16 },
83 { "a", 2, "a%00", 4 },
84 { "a\xff\x01g", 4, "a%FF%01g", 8 },
85 { NULL, 0, NULL, 0 } /* end of list marker */
86 };
87 int i;
89 easy = curl_easy_init();
90 abort_unless(easy, "returned NULL!");
91 for(i = 0; list1[i].in; i++) {
92 int outlen;
93 char *out = curl_easy_unescape(easy, list1[i].in, list1[i].inlen, &outlen);
95 abort_unless(out, "returned NULL!");
96 fail_unless(outlen == list1[i].outlen, "wrong output length returned");
97 fail_unless(!memcmp(out, list1[i].out, list1[i].outlen),
98 "bad output data returned");
100 curl_mprintf("curl_easy_unescape test %d DONE\n", i);
102 curl_free(out);
103 }
105 for(i = 0; list2[i].in; i++) {
106 int outlen;
107 char *out = curl_easy_escape(easy, list2[i].in, list2[i].inlen);
108 abort_unless(out, "returned NULL!");
110 outlen = (int)strlen(out);
111 fail_unless(outlen == list2[i].outlen, "wrong output length returned");
112 fail_unless(!memcmp(out, list2[i].out, list2[i].outlen),
113 "bad output data returned");
115 curl_mprintf("curl_easy_escape test %d DONE (%s)\n", i, out);
117 curl_free(out);
118 }
120 {
121 unsigned char binary[256];
122 char expected[sizeof(binary) * 3 + 1];
123 const char digits[] = "0123456789ABCDEF";
124 size_t encoded_length = 0;
125 unsigned int byte;
126 char *encoded;
127 char *decoded;
128 int decoded_length;
130 for(byte = 0; byte < sizeof(binary); byte++) {
131 binary[byte] = (unsigned char)byte;
132 if((byte >= 'a' && byte <= 'z') || (byte >= 'A' && byte <= 'Z') ||
133 (byte >= '0' && byte <= '9') || byte == '-' || byte == '.' ||
134 byte == '_' || byte == '~')
135 expected[encoded_length++] = (char)byte;
136 else {
137 expected[encoded_length++] = '%';
138 expected[encoded_length++] = digits[byte >> 4];
139 expected[encoded_length++] = digits[byte & 15];
140 }
141 }
142 expected[encoded_length] = 0;
143 encoded = curl_easy_escape(easy, (const char *)binary, sizeof(binary));
144 abort_unless(encoded, "binary escape failed");
145 fail_unless(!strcmp(encoded, expected), "wrong binary escape output");
146 decoded = curl_easy_unescape(easy, encoded, 0, &decoded_length);
147 curl_free(encoded);
148 abort_unless(decoded, "binary unescape failed");
149 fail_unless(decoded_length == sizeof(binary), "wrong binary output size");
150 if(decoded_length == sizeof(binary)) {
151 fail_unless(!memcmp(decoded, binary, sizeof(binary)),
152 "wrong binary data");
153 fail_unless(!decoded[decoded_length], "binary output not terminated");
154 }
155 curl_free(decoded);
156 }
158 UNITTEST_END(t1396_stop(easy))
Diagnostics4 git calls · 121 ms
CallStatusSizeTime0121 ms
discover200152 B2 ms
git.upload-pack discover
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=fetch
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 · 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=116
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.8 KiB116 ms
git.upload-pack fetch
http.response.status_code=200
git.response.bytes=1809
git.response.cache=MISS
git.response.duration_ms=116
git.fetch.wants=1eae1a88e54110b198590cbef2d705a13df2a0f3
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=1809
git.pkt.payload.max=1788
git.sideband.band1.bytes=1787
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
a5e32f8ecc198821
Request
c293e969…
Protocol
v2 · sha1
Agent
gitty/1.0
Filter
advertised
Fetch
shallow filter sideband-all
Capabilities
agent ls-refs fetch object-format