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;
29BEGIN {
30 push(@INC, $ENV{'srcdir'}) if(defined $ENV{'srcdir'});
31 push(@INC, ".");
32}
34use File::Basename;
36use serverhelp qw(
37 server_pidfilename
38 server_logfilename
39 server_exe
40 );
42my $verbose = 0; # set to 1 for debugging
43my $port = 8990; # a default
44my $unix_socket; # location to place a listening Unix socket
45my $ipvnum = 4; # default IP version of http server
46my $idnum = 1; # default http server instance number
47my $proto = 'http'; # protocol the http server speaks
48my $pidfile; # pid file
49my $portfile; # port number file
50my $logfile; # log file
51my $cmdfile; # command file
52my $connect; # IP to connect to on CONNECT
53my $keepalive_secs; # number of seconds to keep idle connections
54my $srcdir;
55my $gopher = 0;
57my $flags = "";
58my $path = '.';
59my $logdir = $path . '/log';
60my $piddir;
62while(@ARGV) {
63 if($ARGV[0] eq '--pidfile') {
64 if($ARGV[1]) {
65 $pidfile = $ARGV[1];
66 shift @ARGV;
67 }
68 }
69 elsif($ARGV[0] eq '--portfile') {
70 if($ARGV[1]) {
71 $portfile = $ARGV[1];
72 shift @ARGV;
73 }
74 }
75 elsif($ARGV[0] eq '--config') {
76 if($ARGV[1]) {
77 $cmdfile = $ARGV[1];
78 shift @ARGV;
79 }
80 }
81 elsif($ARGV[0] eq '--logfile') {
82 if($ARGV[1]) {
83 $logfile = $ARGV[1];
84 shift @ARGV;
85 }
86 }
87 elsif($ARGV[0] eq '--logdir') {
88 if($ARGV[1]) {
89 $logdir = $ARGV[1];
90 shift @ARGV;
91 }
92 }
93 elsif($ARGV[0] eq '--srcdir') {
94 if($ARGV[1]) {
95 $srcdir = $ARGV[1];
96 shift @ARGV;
97 }
98 }
99 elsif($ARGV[0] eq '--ipv4') {
100 $ipvnum = 4;
101 }
102 elsif($ARGV[0] eq '--ipv6') {
103 $ipvnum = 6;
104 }
105 elsif($ARGV[0] eq '--unix-socket') {
106 $ipvnum = 'unix';
107 if($ARGV[1]) {
108 $unix_socket = $ARGV[1];
109 shift @ARGV;
110 }
111 }
112 elsif($ARGV[0] eq '--gopher') {
113 $gopher = 1;
114 }
115 elsif($ARGV[0] eq '--port') {
116 if($ARGV[1] =~ /^(\d+)$/) {
117 $port = $1;
118 shift @ARGV;
119 }
120 }
121 elsif($ARGV[0] eq '--connect') {
122 if($ARGV[1]) {
123 $connect = $ARGV[1];
124 shift @ARGV;
125 }
126 }
127 elsif($ARGV[0] eq '--keepalive') {
128 if($ARGV[1]) {
129 $keepalive_secs = $ARGV[1];
130 shift @ARGV;
131 }
132 }
133 elsif($ARGV[0] eq '--id') {
134 if($ARGV[1] =~ /^(\d+)$/) {
135 $idnum = $1 if($1 > 0);
136 shift @ARGV;
137 }
138 }
139 elsif($ARGV[0] eq '--verbose') {
140 $verbose = 1;
141 }
142 else {
143 print STDERR "\nWarning: http-server.pl unknown parameter: '$ARGV[0]'\n";
144 }
145 shift @ARGV;
146}
148#***************************************************************************
149# Initialize command line option dependent variables
150#
152if($pidfile) {
153 # Use our pidfile directory to store the other pidfiles
154 $piddir = dirname($pidfile);
155}
156else {
157 # Use the current directory to store all the pidfiles
158 $piddir = $path;
159 $pidfile = server_pidfilename($piddir, $proto, $ipvnum, $idnum);
160}
161if(!$portfile) {
162 $portfile = server_portfilename($piddir, $proto, $ipvnum, $idnum);
163}
164if(!$srcdir) {
165 $srcdir = $ENV{'srcdir'} || '.';
166}
167if(!$logfile) {
168 $logfile = server_logfilename($logdir, $proto, $ipvnum, $idnum);
169}
171$flags .= "--pidfile \"$pidfile\" " .
172 "--cmdfile \"$cmdfile\" " .
173 "--logfile \"$logfile\" " .
174 "--logdir \"$logdir\" " .
175 "--portfile \"$portfile\" ";
176$flags .= "--gopher " if($gopher);
177$flags .= "--connect $connect " if($connect);
178$flags .= "--keepalive $keepalive_secs " if($keepalive_secs);
179if($ipvnum eq 'unix') {
180 $flags .= "--unix-socket '$unix_socket' ";
181}
182else {
183 $flags .= "--ipv$ipvnum --port $port ";
184}
185$flags .= "--srcdir \"$srcdir\"";
187if($verbose) {
188 print STDERR "RUN: " . server_exe('sws') . " $flags\n";
189}
191$| = 1;
192exec("exec " . server_exe('sws') . " $flags");
Diagnostics4 git calls · 33 ms
CallStatusSizeTime033 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=2 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
fetch2001.7 KiB · hit27 ms
git.upload-pack fetch http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=fetch git.upstream.dur_ms=27 git.response.bytes=1696 git.response.cache=HIT git.response.duration_ms=27 git.fetch.wants=e94c33cf3e1ccff3a439fba9378ee9635f958bd6 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=1696 git.pkt.payload.max=1675 git.sideband.band1.bytes=1674 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
- a5e1e8d68bc4452a
- Request
- 3c65f243…
- Protocol
- v2 · sha1
- Agent
- gitty/1.0
- Filter
- advertised
- Fetch
- shallow filter sideband-all
- Capabilities
- agent ls-refs fetch object-format