Artifactspublic-v0

curl

master
ply4 git calls38 ms288 KiB3 cachedprotocol v2
217 lines6.6 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 "curl/urlapi.h"
27#include "urlapi-int.h"
29static CURLUcode my_parse_port(CURLU *url, const char *h, bool has_scheme)
31 struct dynbuf host;
32 CURLUcode ret;
33 curlx_dyn_init(&host, 10000);
34 if(curlx_dyn_add(&host, h))
35 return CURLUE_OUT_OF_MEMORY;
36 ret = parse_port(url, &host, has_scheme);
37 curlx_dyn_free(&host);
38 return ret;
41static CURLcode test_unit1653(const char *arg)
43 UNITTEST_BEGIN_SIMPLE
45 CURLU *u;
47 CURLUcode ret;
48 char *ipv6port = NULL;
49 char *portnum;
51 /* Valid IPv6 */
52 u = curl_url();
53 if(!u)
54 goto fail;
55 ipv6port = curlx_strdup("[fe80::250:56ff:fea7:da15]");
56 if(!ipv6port)
57 goto fail;
58 ret = my_parse_port(u, ipv6port, FALSE);
59 fail_unless(ret == CURLUE_OK, "parse_port returned error");
60 ret = curl_url_get(u, CURLUPART_PORT, &portnum, CURLU_NO_DEFAULT_PORT);
61 fail_unless(ret != CURLUE_OK, "curl_url_get portnum returned something");
62 curlx_safefree(ipv6port);
63 curl_url_cleanup(u);
65 /* Invalid IPv6 */
66 u = curl_url();
67 if(!u)
68 goto fail;
69 ipv6port = curlx_strdup("[fe80::250:56ff:fea7:da15|");
70 if(!ipv6port)
71 goto fail;
72 ret = my_parse_port(u, ipv6port, FALSE);
73 fail_unless(ret != CURLUE_OK, "parse_port true on error");
74 curlx_safefree(ipv6port);
75 curl_url_cleanup(u);
77 u = curl_url();
78 if(!u)
79 goto fail;
80 ipv6port = curlx_strdup("[fe80::250:56ff;fea7:da15]:808");
81 if(!ipv6port)
82 goto fail;
83 ret = my_parse_port(u, ipv6port, FALSE);
84 fail_unless(ret == CURLUE_OK, "parse_port returned error");
85 ret = curl_url_get(u, CURLUPART_PORT, &portnum, 0);
86 fail_unless(ret == CURLUE_OK, "curl_url_get portnum returned error");
87 fail_unless(portnum && !strcmp(portnum, "808"), "Check portnumber");
89 curl_free(portnum);
90 curlx_safefree(ipv6port);
91 curl_url_cleanup(u);
93 /* Valid IPv6 with zone index and port number */
94 u = curl_url();
95 if(!u)
96 goto fail;
97 ipv6port = curlx_strdup("[fe80::250:56ff:fea7:da15%25eth3]:80");
98 if(!ipv6port)
99 goto fail;
100 ret = my_parse_port(u, ipv6port, FALSE);
101 fail_unless(ret == CURLUE_OK, "parse_port returned error");
102 ret = curl_url_get(u, CURLUPART_PORT, &portnum, 0);
103 fail_unless(ret == CURLUE_OK, "curl_url_get portnum returned error");
104 fail_unless(portnum && !strcmp(portnum, "80"), "Check portnumber");
105 curl_free(portnum);
106 curlx_safefree(ipv6port);
107 curl_url_cleanup(u);
109 /* Valid IPv6 with zone index without port number */
110 u = curl_url();
111 if(!u)
112 goto fail;
113 ipv6port = curlx_strdup("[fe80::250:56ff:fea7:da15%25eth3]");
114 if(!ipv6port)
115 goto fail;
116 ret = my_parse_port(u, ipv6port, FALSE);
117 fail_unless(ret == CURLUE_OK, "parse_port returned error");
118 curlx_safefree(ipv6port);
119 curl_url_cleanup(u);
121 /* Valid IPv6 with port number */
122 u = curl_url();
123 if(!u)
124 goto fail;
125 ipv6port = curlx_strdup("[fe80::250:56ff:fea7:da15]:81");
126 if(!ipv6port)
127 goto fail;
128 ret = my_parse_port(u, ipv6port, FALSE);
129 fail_unless(ret == CURLUE_OK, "parse_port returned error");
130 ret = curl_url_get(u, CURLUPART_PORT, &portnum, 0);
131 fail_unless(ret == CURLUE_OK, "curl_url_get portnum returned error");
132 fail_unless(portnum && !strcmp(portnum, "81"), "Check portnumber");
133 curl_free(portnum);
134 curlx_safefree(ipv6port);
135 curl_url_cleanup(u);
137 /* Valid IPv6 with syntax error in the port number */
138 u = curl_url();
139 if(!u)
140 goto fail;
141 ipv6port = curlx_strdup("[fe80::250:56ff:fea7:da15];81");
142 if(!ipv6port)
143 goto fail;
144 ret = my_parse_port(u, ipv6port, FALSE);
145 fail_unless(ret != CURLUE_OK, "parse_port true on error");
146 curlx_safefree(ipv6port);
147 curl_url_cleanup(u);
149 u = curl_url();
150 if(!u)
151 goto fail;
152 ipv6port = curlx_strdup("[fe80::250:56ff:fea7:da15]80");
153 if(!ipv6port)
154 goto fail;
155 ret = my_parse_port(u, ipv6port, FALSE);
156 fail_unless(ret != CURLUE_OK, "parse_port true on error");
157 curlx_safefree(ipv6port);
158 curl_url_cleanup(u);
160 /* Valid IPv6 with no port after the colon, should use default if a scheme
161 was used in the URL */
162 u = curl_url();
163 if(!u)
164 goto fail;
165 ipv6port = curlx_strdup("[fe80::250:56ff:fea7:da15]:");
166 if(!ipv6port)
167 goto fail;
168 ret = my_parse_port(u, ipv6port, TRUE);
169 fail_unless(ret == CURLUE_OK, "parse_port returned error");
170 curlx_safefree(ipv6port);
171 curl_url_cleanup(u);
173 /* Incorrect zone index syntax, but the port extractor does not care */
174 u = curl_url();
175 if(!u)
176 goto fail;
177 ipv6port = curlx_strdup("[fe80::250:56ff:fea7:da15!25eth3]:180");
178 if(!ipv6port)
179 goto fail;
180 ret = my_parse_port(u, ipv6port, FALSE);
181 fail_unless(ret == CURLUE_OK, "parse_port returned error");
182 ret = curl_url_get(u, CURLUPART_PORT, &portnum, 0);
183 fail_unless(ret == CURLUE_OK, "curl_url_get portnum returned error");
184 fail_unless(portnum && !strcmp(portnum, "180"), "Check portnumber");
185 curl_free(portnum);
186 curlx_safefree(ipv6port);
187 curl_url_cleanup(u);
189 /* Non percent-encoded zone index */
190 u = curl_url();
191 if(!u)
192 goto fail;
193 ipv6port = curlx_strdup("[fe80::250:56ff:fea7:da15%eth3]:80");
194 if(!ipv6port)
195 goto fail;
196 ret = my_parse_port(u, ipv6port, FALSE);
197 fail_unless(ret == CURLUE_OK, "parse_port returned error");
198 curlx_safefree(ipv6port);
199 curl_url_cleanup(u);
201 /* No scheme and no digits following the colon - not accepted. Because that
202 makes (a*50):// that looks like a scheme be an acceptable input. */
203 u = curl_url();
204 if(!u)
205 goto fail;
206 ipv6port = curlx_strdup("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
207 "aaaaaaaaaaaaaaaaaaaaaa:");
208 if(!ipv6port)
209 goto fail;
210 ret = my_parse_port(u, ipv6port, FALSE);
211 fail_unless(ret == CURLUE_BAD_PORT_NUMBER, "parse_port did wrong");
212fail:
213 curlx_free(ipv6port);
214 curl_url_cleanup(u);
216 UNITTEST_END_SIMPLE
Diagnostics4 git calls · 38 ms
CallStatusSizeTime038 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 · hit3 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=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.4 KiB · hit32 ms
git.upload-pack fetch
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=fetch
git.upstream.dur_ms=32
git.response.bytes=1457
git.response.cache=HIT
git.response.duration_ms=32
git.fetch.wants=64445c45146d49d652a51d4b16772a47e74d0c64
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=1457
git.pkt.payload.max=1436
git.sideband.band1.bytes=1435
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
a5e1ffb04fc8a9c0
Request
71d601e0…
Protocol
v2 · sha1
Agent
gitty/1.0
Filter
advertised
Fetch
shallow filter sideband-all
Capabilities
agent ls-refs fetch object-format