Artifactspublic-v0

curl

master
ply4 git calls77 ms290 KiB3 cachedprotocol v2
316 lines8.7 KiBexecutableRaw
1#!/usr/bin/env perl
2#***************************************************************************
3# _ _ ____ _
4# Project ___| | | | _ \| |
5# / __| | | | |_) | |
6# | (__| |_| | _ <| |___
7# \___|\___/|_| \_\_____|
8#
9# Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
11# This software is licensed as described in the file COPYING, which
12# you should have received as part of this distribution. The terms
13# are also available at https://curl.se/docs/copyright.html.
15# You may opt to use, copy, modify, merge, publish, distribute and/or sell
16# copies of the Software, and permit persons to whom the Software is
17# furnished to do so, under the terms of the COPYING file.
19# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
20# KIND, either express or implied.
22# SPDX-License-Identifier: curl
24###########################################################################
26# Scan symbols-in-version (which is verified to be correct by test 1119), then
27# verify that each option mention in there that should have its own man page
28# actually does.
30# In addition, make sure that every current option to curl_easy_setopt,
31# curl_easy_getinfo and curl_multi_setopt are also mentioned in their
32# corresponding main (index) man page.
34# src/tool_getparam.c lists all options curl can parse
35# docs/curl.1 documents all command line options
36# src/tool_listhelp.c outputs all options with curl -h
37# - make sure they are all in sync
39# Output all deviances to stderr.
41use strict;
42use warnings;
44# we may get the directory roots pointed out
45my $root = $ARGV[0] || ".";
46my $buildroot = $ARGV[1] || ".";
47my $syms = "$root/docs/libcurl/symbols-in-versions";
48my $curlh = "$root/include/curl/curl.h";
49my $errors = 0;
51# the prepopulated alias list is the CURLINFO_* defines that are used for the
52# debug function callback and the fact that they use the same prefix as the
53# curl_easy_getinfo options was a mistake.
54my %alias = (
55 'CURLINFO_DATA_IN' => 'none',
56 'CURLINFO_DATA_OUT' => 'none',
57 'CURLINFO_END' => 'none',
58 'CURLINFO_HEADER_IN' => 'none',
59 'CURLINFO_HEADER_OUT' => 'none',
60 'CURLINFO_LASTONE' => 'none',
61 'CURLINFO_NONE' => 'none',
62 'CURLINFO_SSL_DATA_IN' => 'none',
63 'CURLINFO_SSL_DATA_OUT' => 'none',
64 'CURLINFO_TEXT' => 'none'
65 );
67sub scanmdpage {
68 my ($file, @words) = @_;
70 open(my $mh, "<", $file) or die "could not open $file";
71 my @m;
72 while(<$mh>) {
73 if($_ =~ /^## (.*)/) {
74 my $w = $1;
75 # "unquote" minuses
76 $w =~ s/\\-/-/g;
77 push @m, $w;
78 }
79 }
80 close($mh);
82 my @ms = sort @m;
83 for my $i (0 .. $#m) {
84 if($ms[$i] ne $m[$i]) {
85 print STDERR "$file:1:ERROR: $m[$i] is not alphabetical (expected $ms[$i])\n";
86 $errors++;
87 # no point in reporting many
88 last;
89 }
90 }
91 foreach my $m (@words) {
92 my @g = grep(/$m\b/, @m);
93 if(!$g[0]) {
94 print STDERR "Missing mention of $m in $file\n";
95 $errors++;
96 }
97 }
100my $r;
102# check for define aliases
103open($r, "<", $curlh) or die "no curl.h";
104while(<$r>) {
105 if(/^\#define (CURL(OPT|INFO|MOPT)_\w+) (.*)/) {
106 $alias{$1} = $3;
107 }
109close($r);
111my @curlopt;
112my @curlinfo;
113my @curlmopt;
114open($r, "<", $syms) or die "no input file";
115while(<$r>) {
116 chomp;
117 my $l = $_;
118 if($l =~ /(CURL(OPT|INFO|MOPT)_\w+) *([0-9.]*) *([0-9.-]*) *([0-9.]*)/) {
119 my ($opt, $type, $add, $dep, $rem) = ($1, $2, $3, $4, $5);
121 if($alias{$opt}) {
122 #print "$opt => $alias{$opt}\n";
123 }
124 elsif($rem) {
125 # $opt was removed in $rem
126 # so do not check for that
127 }
128 else {
129 if($type eq "OPT") {
130 push @curlopt, $opt,
131 }
132 elsif($type eq "INFO") {
133 push @curlinfo, $opt,
134 }
135 elsif($type eq "MOPT") {
136 push @curlmopt, $opt,
137 }
138 if(! -f "$root/docs/libcurl/opts/$opt.md") {
139 print STDERR "Missing $opt.md\n";
140 $errors++;
141 }
142 }
143 }
145close($r);
147scanmdpage("$root/docs/libcurl/curl_easy_setopt.md", @curlopt);
148scanmdpage("$root/docs/libcurl/curl_easy_getinfo.md", @curlinfo);
149scanmdpage("$root/docs/libcurl/curl_multi_setopt.md", @curlmopt);
151# using this hash array, we can skip specific options
152my %opts = (
153 # pretend these --no options exists in tool_getparam.c
154 '--no-alpn' => 1,
155 '--no-npn' => 1,
156 '-N, --no-buffer' => 1,
157 '--no-sessionid' => 1,
158 '--no-keepalive' => 1,
159 '--no-progress-meter' => 1,
160 '--no-clobber' => 1,
162 # pretend these options without -no exist in curl.1 and tool_listhelp.c
163 '--alpn' => 6,
164 '--npn' => 6,
165 '--eprt' => 6,
166 '--epsv' => 6,
167 '--keepalive' => 6,
168 '-N, --buffer' => 6,
169 '--sessionid' => 6,
170 '--progress-meter' => 6,
171 '--clobber' => 6,
173 # deprecated options do not need to be in tool_help.c nor curl.1
174 '--krb4' => 6,
175 '--ftp-ssl' => 6,
176 '--ftp-ssl-reqd' => 6,
177 '--include' => 6,
179 # for tests and debug only, can remain hidden
180 '--test-duphandle' => 6,
181 '--test-event' => 6,
182 '--wdebug' => 6,
183 );
185#########################################################################
186# parse the curl code that parses the command line arguments!
187open($r, "<", "$root/src/tool_getparam.c") or die "no input file";
188my $list;
189my @getparam; # store all parsed parameters
191my $prevlong = "";
192my $no = 0;
193while(<$r>) {
194 $no++;
195 chomp;
196 if(/struct LongShort aliases/) {
197 $list = 1;
198 }
199 elsif($list) {
200 if(/^ \{(\"[^,]*\").*\'(.)\',/) {
201 my ($l, $s) = ($1, $2);
202 my $sh;
203 my $lo;
204 my $title;
205 if(($l cmp $prevlong) < 0) {
206 print STDERR "tool_getparam.c:$no: '$l' is NOT placed in alpha-order\n";
207 }
208 if($l =~ /\"(.*)\"/) {
209 # long option
210 $lo = $1;
211 $title = "--$lo";
212 }
213 if($s ne " ") {
214 # a short option
215 $sh = $s;
216 $title = "-$sh, $title";
217 }
218 push @getparam, $title;
219 $opts{$title} |= 1;
220 $prevlong = $l;
221 }
222 }
224close($r);
226#########################################################################
227# parse the curl.1 man page, extract all documented command line options
228# The man page may or may not be rebuilt, so check both possible locations
229open($r, "<", "$buildroot/docs/cmdline-opts/curl.1") or
230 open($r, "<", "$root/docs/cmdline-opts/curl.1") or
231 die "failed getting curl.1";
232my @manpage; # store all parsed parameters
233while(<$r>) {
234 chomp;
235 my $l = $_;
236 $l =~ s/\\-/-/g;
237 if($l =~ /^\.IP \"(-[^\"]*)\"/) {
238 my $str = $1;
239 my $combo;
240 if($str =~ /^-(.), --([a-z0-9.-]*)/) {
241 # figure out the -short, --long combo
242 $combo = "-$1, --$2";
243 }
244 elsif($str =~ /^--([a-z0-9.-]*)/) {
245 # figure out the --long name
246 $combo = "--$1";
247 }
248 if($combo) {
249 push @manpage, $combo;
250 $opts{$combo} |= 2;
251 }
252 }
254close($r);
256#########################################################################
257# parse the curl code that outputs the curl -h list
258open($r, "<", "$root/src/tool_listhelp.c") or die "no input file";
259my @toolhelp; # store all parsed parameters
260while(<$r>) {
261 chomp;
262 my $l = $_;
263 if(/^ \{ \" *(.*)/) {
264 my $str = $1;
265 my $combo;
266 if($str =~ /^-(.), --([a-z0-9.-]*)/) {
267 # figure out the -short, --long combo
268 $combo = "-$1, --$2";
269 }
270 elsif($str =~ /^--([a-z0-9.-]*)/) {
271 # figure out the --long name
272 $combo = "--$1";
273 }
274 if($combo) {
275 push @toolhelp, $combo;
276 $opts{$combo} |= 4;
277 }
278 }
280close($r);
283# Now we have three arrays with options to cross-reference.
285foreach my $o (keys %opts) {
286 my $where = $opts{$o};
288 if($where != 7) {
289 # this is not in all three places
290 $errors++;
291 my $exists;
292 my $missing;
293 if($where & 1) {
294 $exists = " tool_getparam.c";
295 }
296 else {
297 $missing = " tool_getparam.c";
298 }
299 if($where & 2) {
300 $exists.= " curl.1";
301 }
302 else {
303 $missing.= " curl.1";
304 }
305 if($where & 4) {
306 $exists .= " tool_listhelp.c";
307 }
308 else {
309 $missing .= " tool_listhelp.c";
310 }
312 print STDERR "$o is not in$missing (but in$exists)\n";
313 }
316print STDERR "$errors\n";
Diagnostics4 git calls · 77 ms
CallStatusSizeTime077 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 · hit24 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=24
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
fetch2003.0 KiB · hit50 ms
git.upload-pack fetch
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=fetch
git.upstream.dur_ms=50
git.response.bytes=3092
git.response.cache=HIT
git.response.duration_ms=50
git.fetch.wants=ac09d4f59021187af95ec5f0d2a54ce4debe6ace
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=3092
git.pkt.payload.max=3071
git.sideband.band1.bytes=3070
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
a5e1d2582b223f27
Request
d5314a14…
Protocol
v2 · sha1
Agent
gitty/1.0
Filter
advertised
Fetch
shallow filter sideband-all
Capabilities
agent ls-refs fetch object-format