Artifactspublic-v0

curl

master
ply4 git calls159 ms288 KiB2 cachedprotocol v2
169 lines5.2 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 "curl_get_line.h"
27static CURLcode test_unit3200(const char *arg)
29 UNITTEST_BEGIN_SIMPLE
31#if !defined(CURL_DISABLE_COOKIES) || !defined(CURL_DISABLE_ALTSVC) || \
32 !defined(CURL_DISABLE_HSTS) || !defined(CURL_DISABLE_NETRC)
34#ifdef CURL_HAVE_DIAG
35#pragma GCC diagnostic push
36#pragma GCC diagnostic ignored "-Woverlength-strings"
37#endif
39 /* The test XML does not supply a way to write files without newlines
40 * so we write our own
41 */
43#define C64 "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"
44#define C256 C64 C64 C64 C64
45#define C1024 C256 C256 C256 C256
46#define C4096 C1024 C1024 C1024 C1024
48 static const char * const filecontents[] = {
49 /* Both should be read */
50 "LINE1\n"
51 "LINE2 NEWLINE\n",
53 /* Both should be read */
54 "LINE1\n"
55 "LINE2 NONEWLINE",
57 /* Only first should be read */
58 "LINE1\n"
59 C4096,
61 /* First line should be read */
62 "LINE1\n"
63 C4096 "SOME EXTRA TEXT",
65 /* Only first should be read */
66 "LINE1\n"
67 C4096 "SOME EXTRA TEXT\n"
68 "LINE3\n",
70 "LINE1\x1aTEST"
71 };
73#ifdef CURL_HAVE_DIAG
74#pragma GCC diagnostic pop
75#endif
77 size_t i;
78 CURLcode result = CURLE_OK;
79 for(i = 0; i < CURL_ARRAYSIZE(filecontents); i++) {
80 FILE *fp;
81 struct dynbuf buf;
82 size_t len = 4096;
83 const char *line;
84 bool eof;
85 curlx_dyn_init(&buf, len);
87 fp = curlx_fopen(arg, "wb");
88 abort_unless(fp, "Cannot open testfile");
89 fwrite(filecontents[i], 1, strlen(filecontents[i]), fp);
90 curlx_fclose(fp);
92 fp = curlx_fopen(arg, "rb");
93 abort_unless(fp, "Cannot open testfile");
95 curl_mfprintf(stderr, "Test %zu...", i);
96 switch(i) {
97 case 0:
98 result = Curl_get_line(&buf, fp, &eof);
99 line = curlx_dyn_ptr(&buf);
100 fail_unless(!result && line && !strcmp("LINE1\n", line),
101 "First line failed (1)");
102 result = Curl_get_line(&buf, fp, &eof);
103 line = curlx_dyn_ptr(&buf);
104 fail_unless(!result && line && !strcmp("LINE2 NEWLINE\n", line),
105 "Second line failed (1)");
106 result = Curl_get_line(&buf, fp, &eof);
107 abort_unless(eof, "Missed EOF (1)");
108 break;
109 case 1:
110 result = Curl_get_line(&buf, fp, &eof);
111 line = curlx_dyn_ptr(&buf);
112 fail_unless(!result && line && !strcmp("LINE1\n", line),
113 "First line failed (2)");
114 result = Curl_get_line(&buf, fp, &eof);
115 line = curlx_dyn_ptr(&buf);
116 fail_unless(!result && line && !strcmp("LINE2 NONEWLINE\n", line),
117 "Second line failed (2)");
118 result = Curl_get_line(&buf, fp, &eof);
119 abort_unless(eof, "Missed EOF (2)");
120 break;
121 case 2:
122 result = Curl_get_line(&buf, fp, &eof);
123 line = curlx_dyn_ptr(&buf);
124 fail_unless(!result && line && !strcmp("LINE1\n", line),
125 "First line failed (3)");
126 result = Curl_get_line(&buf, fp, &eof);
127 fail_unless(!curlx_dyn_len(&buf),
128 "Did not detect max read on EOF (3)");
129 break;
130 case 3:
131 result = Curl_get_line(&buf, fp, &eof);
132 line = curlx_dyn_ptr(&buf);
133 fail_unless(!result && line && !strcmp("LINE1\n", line),
134 "First line failed (4)");
135 result = Curl_get_line(&buf, fp, &eof);
136 fail_unless(!curlx_dyn_len(&buf),
137 "Did not ignore partial on EOF (4)");
138 break;
139 case 4:
140 result = Curl_get_line(&buf, fp, &eof);
141 line = curlx_dyn_ptr(&buf);
142 fail_unless(!result && line && !strcmp("LINE1\n", line),
143 "First line failed (5)");
144 result = Curl_get_line(&buf, fp, &eof);
145 fail_unless(!curlx_dyn_len(&buf),
146 "Did not bail out on too long line");
147 break;
148 case 5:
149 result = Curl_get_line(&buf, fp, &eof);
150 line = curlx_dyn_ptr(&buf);
151 fail_unless(!result && line && !strcmp("LINE1\x1aTEST\n", line),
152 "Missed/Misinterpreted ^Z (6)");
153 result = Curl_get_line(&buf, fp, &eof);
154 abort_unless(eof, "Missed EOF (6)");
155 break;
156 default:
157 abort_unless(1, "Unknown case");
158 break;
159 }
160 curlx_dyn_free(&buf);
161 curlx_fclose(fp);
162 curl_mfprintf(stderr, "OK\n");
163 }
164 return result;
166#endif
168 UNITTEST_END_SIMPLE
Diagnostics4 git calls · 159 ms
CallStatusSizeTime0159 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 · hit23 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=23
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.6 KiB133 ms
git.upload-pack fetch
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=fetch
git.upstream.dur_ms=133
git.response.bytes=1592
git.response.cache=MISS
git.response.duration_ms=133
git.fetch.wants=23e5d567135b34f8e0e096ac076d69581e6d2449
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=1592
git.pkt.payload.max=1571
git.sideband.band1.bytes=1570
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
a5e1fce15fb8a9c0
Request
eafaa2ea…
Protocol
v2 · sha1
Agent
gitty/1.0
Filter
advertised
Fetch
shallow filter sideband-all
Capabilities
agent ls-refs fetch object-format