Artifactspublic-v0

curl

master
ply4 git calls182 ms289 KiB2 cachedprotocol v2
148 lines5.6 KiBexecutableRaw
1#!/usr/bin/env perl
2#***************************************************************************
3# _ _ ____ _
4# Project ___| | | | _ \| |
5# / __| | | | |_) | |
6# | (__| |_| | _ <| |___
7# \___|\___/|_| \_\_____|
8#
9# Copyright (C) EdelWeb for EdelKey and OpenEvidence
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###########################################################################
26use strict;
27use warnings;
29use File::Basename;
30use File::Spec;
31use IPC::Open3;
32use Symbol 'gensym';
34sub opensslfail {
35 die "Missing or unsupported 'openssl' tool. openssl 1.0.2+ required. " .
36 "Without it, this script cannot generate the necessary certificates " .
37 "the curl test suite needs for all its TLS related tests.";
40my $OPENSSL = 'openssl';
41if(-f '/usr/local/ssl/bin/openssl') {
42 $OPENSSL = '/usr/local/ssl/bin/openssl';
45my $SRCDIR = dirname(__FILE__);
46my $fh;
48my $KEYSIZE = 'prime256v1';
49my $DURATION;
50my $PREFIX;
52sub redir {
53 my $outfn = shift if($_[0] =~ /^>/);
54 my $hideerr = shift if($_[0] =~ /^2>/);
55 open(my $outfd, $outfn) or die if($outfn);
56 my $pid = open3(my $in, my $out, my $err = gensym, @_);
57 if(!$hideerr) { while(<$err>) { print STDERR $_; }; }
58 if($outfn) { while(<$out>) { print $outfd $_; }; close($outfd); }
59 else { while(<$out>) { print $_; }; }
60 waitpid($pid, 0);
63my $CAPREFIX = shift @ARGV;
64if(!$CAPREFIX) {
65 print "Usage: genserv.pl <caprefix> [<prefix> ...]\n";
66 exit 1;
68elsif(! -f "$CAPREFIX-ca.cacert" ||
69 ! -f "$CAPREFIX-ca.key") {
71 if($OPENSSL eq basename($OPENSSL)) { # has no directory component
72 # find openssl in PATH
73 my $found = 0;
74 foreach(File::Spec->path()) {
75 my $file = File::Spec->catfile($_, $OPENSSL);
76 if(-f $file) {
77 $OPENSSL = $file;
78 $found = 1;
79 last;
80 }
81 }
82 if(!$found) {
83 printf "PATH used: %s\n", join(', ', File::Spec->path());
84 opensslfail();
85 }
86 }
88 print "$OPENSSL\n";
89 system($OPENSSL, ('version'));
91 $PREFIX = $CAPREFIX;
92 $DURATION = 6000;
94 if(system($OPENSSL, ('genpkey', '-algorithm', 'EC', '-pkeyopt', "ec_paramgen_curve:$KEYSIZE", '-pkeyopt', 'ec_param_enc:named_curve',
95 '-out', "$PREFIX-ca.key", '-pass', 'pass:secret')) != 0) {
96 opensslfail();
97 }
98 redir('2>', $OPENSSL, ('req', '-config', "$SRCDIR/$PREFIX-ca.prm", '-new', '-key', "$PREFIX-ca.key", '-out', "$PREFIX-ca.csr", '-passin', 'pass:secret'));
99 system($OPENSSL, ('x509', '-sha256', '-extfile', "$SRCDIR/$PREFIX-ca.prm", '-days', $DURATION,
100 '-req', '-signkey', "$PREFIX-ca.key", '-in', "$PREFIX-ca.csr", '-out', "$PREFIX-ca.raw-cacert"));
101 redir(">$PREFIX-ca.cacert", $OPENSSL, ('x509', '-in', "$PREFIX-ca.raw-cacert", '-text', '-nameopt', 'multiline'));
102 system($OPENSSL, ('x509', '-in', "$PREFIX-ca.cacert", '-outform', 'der', '-out', "$PREFIX-ca.der"));
103 redir(">$PREFIX-ca.crt", $OPENSSL, ('x509', '-in', "$PREFIX-ca.cacert", '-text', '-nameopt', 'multiline'));
105 print "CA root generated: $PREFIX $DURATION days $KEYSIZE\n";
108$DURATION = 300;
110open($fh, '>>', "$CAPREFIX-ca.db") and close($fh); # for revoke server cert
112while(@ARGV) {
113 $PREFIX = shift @ARGV;
114 $PREFIX =~ s/\.prm$//;
116 # pseudo-secrets
117 system($OPENSSL, ('genpkey', '-algorithm', 'EC', '-pkeyopt', "ec_paramgen_curve:$KEYSIZE", '-pkeyopt', 'ec_param_enc:named_curve',
118 '-out', "$PREFIX.keyenc", '-pass', 'pass:secret'));
119 redir('2>', $OPENSSL, ('req', '-config', "$SRCDIR/$PREFIX.prm", '-new', '-key', "$PREFIX.keyenc", '-out', "$PREFIX.csr", '-passin', 'pass:secret'));
120 system($OPENSSL, ('pkey', '-in', "$PREFIX.keyenc", '-out', "$PREFIX.key", '-passin', 'pass:secret'));
122 system($OPENSSL, ('pkey', '-in', "$PREFIX.key", '-pubout', '-outform', 'DER', '-out', "$PREFIX.pub.der"));
123 system($OPENSSL, ('pkey', '-in', "$PREFIX.key", '-pubout', '-outform', 'PEM', '-out', "$PREFIX.pub.pem"));
124 redir(">$PREFIX.crt", '2>', $OPENSSL, ('x509', '-sha256', '-extfile', "$SRCDIR/$PREFIX.prm", '-days', $DURATION,
125 '-req', '-CA', "$CAPREFIX-ca.cacert", '-CAkey', "$CAPREFIX-ca.key", '-CAcreateserial', '-in', "$PREFIX.csr"));
127 # revoke server cert
128 if(open($fh, '>', "$CAPREFIX-ca.cnt")) {
129 print $fh '01';
130 close($fh);
131 }
132 redir('2>', $OPENSSL, ('ca', '-config', "$SRCDIR/$CAPREFIX-ca.cnf", '-revoke', "$PREFIX.crt"));
134 # issue CRL
135 redir('2>', $OPENSSL, ('ca', '-config', "$SRCDIR/$CAPREFIX-ca.cnf", '-gencrl', '-out', "$PREFIX.crl"));
136 system($OPENSSL, ('x509', '-in', "$PREFIX.crt", '-outform', 'der', '-out', "$PREFIX.der"));
138 # concatenate all together now
139 open($fh, '>', "$PREFIX.pem") and close($fh);
140 chmod 0600, "$PREFIX.pem";
141 if(open($fh, '>>', "$PREFIX.pem")) {
142 my $fi;
143 print $fh do { local $/; open $fi, '<', $_ and <$fi> } for("$SRCDIR/$PREFIX.prm", "$PREFIX.key", "$PREFIX.crt");
144 close($fh);
145 }
147 print "Certificate generated: CA=$CAPREFIX ${DURATION}days $KEYSIZE $PREFIX\n";
Diagnostics4 git calls · 182 ms
CallStatusSizeTime0182 ms
discover200152 B3 ms
git.upload-pack discover
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=fetch
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 · 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 · hit2 ms
git.upload-pack fetch
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=fetch
git.upstream.dur_ms=177
git.response.bytes=293470
git.response.cache=HIT
git.response.duration_ms=2
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
fetch2002.1 KiB177 ms
git.upload-pack fetch
http.response.status_code=200
git.response.bytes=2121
git.response.cache=MISS
git.response.duration_ms=177
git.fetch.wants=f4e95f33cd34b25707be638c2e34a85ac4842350
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=2121
git.pkt.payload.max=2100
git.sideband.band1.bytes=2099
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
a5e342d869ac6e2a
Request
1b6ccc8b…
Protocol
v2 · sha1
Agent
gitty/1.0
Filter
advertised
Fetch
shallow filter sideband-all
Capabilities
agent ls-refs fetch object-format