master
1#!/usr/bin/env perl
2#***************************************************************************
3# _ _ ____ _
4# Project ___| | | | _ \| |
5# / __| | | | |_) | |
6# | (__| |_| | _ <| |___
7# \___|\___/|_| \_\_____|
8#
9# Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
10#
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.
14#
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.
18#
19# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
20# KIND, either express or implied.
21#
22# SPDX-License-Identifier: curl
23#
24###########################################################################
26use strict;
27use warnings;
29my $c = 0;
30if(@ARGV && $ARGV[0] eq "-c") {
31 $c = 1;
32 shift @ARGV;
33}
35my @out;
37push @out, " _ _ ____ _\n";
38push @out, " ___| | | | _ \\| |\n";
39push @out, " / __| | | | |_) | |\n";
40push @out, " | (__| |_| | _ <| |___\n";
41push @out, " \\___|\\___/|_| \\_\\_____|\n";
43while(<STDIN>) {
44 my $line = $_;
45 push @out, $line;
46}
48print <<HEAD
49/*
50 * NEVER EVER edit this manually, fix the mkhelp.pl script instead!
51 */
52#include "tool_hugehelp.h"
53#ifdef USE_MANUAL
54#include "tool_help.h"
56HEAD
57 ;
58if($c) {
59 # If compression requested, check that the Gzip module is available
60 # or else disable compression
61 $c = eval
62 {
63 require IO::Compress::Gzip;
64 IO::Compress::Gzip->import();
65 1;
66 };
67 print STDERR "Warning: compression requested but Gzip is not available\n" if(!$c)
68}
70if($c)
71{
72 my $content = join("", @out);
73 my $gzippedContent;
74 IO::Compress::Gzip::gzip(
75 \$content, \$gzippedContent, Level => 9, TextFlag => 1, Time=>0) or die "gzip failed:";
76 my $gzip = length($content);
77 my $gzipped = length($gzippedContent);
79 print <<HEAD
80#include <zlib.h>
81static const unsigned char hugehelpgz[] = {
82 /* This mumbo-jumbo is the huge help text compressed with gzip.
83 Thanks to this operation, the size of this data shrank from $gzip
84 to $gzipped bytes. You can disable the use of compressed help
85 texts by NOT passing -c to the mkhelp.pl tool. */
86HEAD
87;
89 my $c = 0;
90 for(split(//, $gzippedContent)) {
91 my $num = ord($_);
92 if(!($c % 12)) {
93 print " ";
94 }
95 printf(" 0x%02x,", 0 + $num);
96 if(!(++$c % 12)) {
97 print "\n";
98 }
99 }
100 print "\n};\n";
102 print <<EOF
103#define BUF_SIZE 0x10000
104static voidpf zalloc_func(voidpf opaque, unsigned int items, unsigned int size)
105{
106 (void)opaque;
107 /* not a typo, keep it curlx_calloc() */
108 return curlx_calloc(items, size);
109}
110static void zfree_func(voidpf opaque, voidpf ptr)
111{
112 (void)opaque;
113 curlx_free(ptr);
114}
116#define HEADERLEN 10
118/* Decompress and send to stdout a gzip-compressed buffer */
119void hugehelp(void)
120{
121 unsigned char *buf;
122 int status;
123 z_stream z;
125 /* Make sure no gzip options are set */
126 if(hugehelpgz[3] & 0xfe)
127 return;
129 memset(&z, 0, sizeof(z_stream));
130 z.zalloc = (alloc_func)zalloc_func;
131 z.zfree = (free_func)zfree_func;
132 z.avail_in = (uInt)(sizeof(hugehelpgz) - HEADERLEN);
133 z.next_in = (z_const Bytef *)hugehelpgz + HEADERLEN;
135 if(inflateInit2(&z, -MAX_WBITS) != Z_OK)
136 return;
138 buf = curlx_malloc(BUF_SIZE);
139 if(buf) {
140 while(1) {
141 z.avail_out = BUF_SIZE;
142 z.next_out = buf;
143 status = inflate(&z, Z_SYNC_FLUSH);
144 if(status == Z_OK || status == Z_STREAM_END) {
145 fwrite(buf, BUF_SIZE - z.avail_out, 1, stdout);
146 if(status == Z_STREAM_END)
147 break;
148 }
149 else
150 break; /* error */
151 }
152 curlx_free(buf);
153 }
154 inflateEnd(&z);
155}
157/* Show the help text for the 'arg' curl argument on stdout */
158void showhelp(const char *trigger, const char *arg, const char *endarg)
159{
160 unsigned char *buf;
161 int status;
162 z_stream z;
163 struct scan_ctx ctx;
164 inithelpscan(&ctx, trigger, arg, endarg);
166 /* Make sure no gzip options are set */
167 if(hugehelpgz[3] & 0xfe)
168 return;
170 memset(&z, 0, sizeof(z_stream));
171 z.zalloc = (alloc_func)zalloc_func;
172 z.zfree = (free_func)zfree_func;
173 z.avail_in = (uInt)(sizeof(hugehelpgz) - HEADERLEN);
174 z.next_in = (z_const Bytef *)hugehelpgz + HEADERLEN;
176 if(inflateInit2(&z, -MAX_WBITS) != Z_OK)
177 return;
179 buf = curlx_malloc(BUF_SIZE);
180 if(buf) {
181 while(1) {
182 z.avail_out = BUF_SIZE;
183 z.next_out = buf;
184 status = inflate(&z, Z_SYNC_FLUSH);
185 if(status == Z_OK || status == Z_STREAM_END) {
186 size_t len = BUF_SIZE - z.avail_out;
187 if(!helpscan(buf, len, &ctx))
188 break;
189 if(status == Z_STREAM_END)
190 break;
191 }
192 else
193 break; /* error */
194 }
195 curlx_free(buf);
196 }
197 inflateEnd(&z);
198}
199EOF
200 ;
201foot();
202exit;
203}
204else {
205 print <<HEAD
206static const char * const curlman[] = {
207HEAD
208 ;
209}
211my $blank;
212for my $n (@out) {
213 chomp $n;
214 $n =~ s/\\/\\\\/g;
215 $n =~ s/\"/\\\"/g;
216 $n =~ s/\t/\\t/g;
218 if(!$n) {
219 $blank++;
220 }
221 else {
222 $n =~ s/ /\\t/g;
223 printf(" \"%s%s\",\n", $blank ? "\\n" : "", $n);
224 $blank = 0;
225 }
226}
228print <<ENDLINE
229 NULL
230};
231void hugehelp(void)
232{
233 int i = 0;
234 while(curlman[i])
235 puts(curlman[i++]);
236}
238/* Show the help text for the 'arg' curl argument on stdout */
239void showhelp(const char *trigger, const char *arg, const char *endarg)
240{
241 int i = 0;
242 struct scan_ctx ctx;
243 inithelpscan(&ctx, trigger, arg, endarg);
244 while(curlman[i]) {
245 size_t len = strlen(curlman[i]);
246 if(!helpscan((const unsigned char *)curlman[i], len, &ctx) ||
247 !helpscan((const unsigned char *)"\\n", 1, &ctx))
248 break;
249 i++;
250 }
251}
252ENDLINE
253 ;
255foot();
257sub foot {
258 print <<FOOT
259#endif /* USE_MANUAL */
260FOOT
261 ;
262}
Diagnostics4 git calls · 30 ms
CallStatusSizeTime030 ms
discover200152 B2 ms
git.upload-pack discover http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=ls-refs 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 · 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=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=86Open pack map
fetch2002.3 KiB · hit25 ms
git.upload-pack fetch http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=fetch git.upstream.dur_ms=25 git.response.bytes=2329 git.response.cache=HIT git.response.duration_ms=25 git.fetch.wants=013ddc51c80b0752f98ec35874f97c2b3f6d19f2 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=2329 git.pkt.payload.max=2308 git.sideband.band1.bytes=2307 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
- a5e1d9503a4ca151
- Request
- e60eebbd…
- Protocol
- v2 · sha1
- Agent
- gitty/1.0
- Filter
- advertised
- Fetch
- shallow filter sideband-all
- Capabilities
- agent ls-refs fetch object-format