Artifactspublic-v0

curl

master
ply4 git calls27 ms289 KiB3 cachedprotocol v2
214 lines6.6 KiBRaw
1###########################################################################
2# _ _ ____ _
3# Project ___| | | | _ \| |
4# / __| | | | |_) | |
5# | (__| |_| | _ <| |___
6# \___|\___/|_| \_\_____|
7#
8# Copyright (C) Evgeny Grin (Karlson2k), <k2k@narod.ru>.
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.
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.
18# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19# KIND, either express or implied.
21# SPDX-License-Identifier: curl
23###########################################################################
25# This Perl package helps with path transforming when running curl tests on
26# native Windows and MSYS/Cygwin.
27# Following input formats are supported (via built-in Perl functions):
28# (1) /some/path - absolute path in POSIX-style
29# (2) D:/some/path - absolute path in Windows-style
30# (3) some/path - relative path
31# (4) D:some/path - path relative to current directory on Windows drive
32# (paths like 'D:' are treated as 'D:./') (*)
33# (5) \some/path - path from root directory on current Windows drive (*)
34# All forward '/' and back '\' slashes are treated identically except leading
35# slash in forms (1) and (5).
36# Forward slashes are simpler processed in Perl, do not require extra escaping
37# for shell (unlike back slashes) and accepted by Windows native programs, so
38# all functions return paths with only forward slashes.
39# All returned paths do not contain any duplicated slashes, only single slashes
40# are used as directory separators on output.
41# On non-Windows platforms functions acts as transparent wrappers for similar
42# Perl's functions or return unmodified string (depending on functionality),
43# so all functions can be unconditionally used on all platforms.
45# (*) CAUTION! Forms (4) and (5) are not recommended to use as they can be
46# interpreted incorrectly in Perl and MSYS/Cygwin environment have low
47# control on Windows current drive and Windows current path on specific
48# drive.
50package pathhelp;
52use strict;
53use warnings;
54use File::Spec;
56BEGIN {
57 use base qw(Exporter);
59 our @EXPORT_OK = qw(
60 os_is_win
61 exe_ext
62 dirsepadd
63 shell_quote
64 sys_native_abs_path
65 sys_native_current_path
66 build_sys_abs_path
67 );
70#######################################################################
71# Block for cached static variables
74 # Cached static variable, Perl 5.0-compatible.
75 my $is_win = $^O eq 'MSWin32' ||
76 $^O eq 'cygwin' ||
77 $^O eq 'msys';
79 # Returns boolean true if OS is any form of Windows.
80 sub os_is_win {
81 return $is_win;
82 }
84 # Cached static variable, Perl 5.0-compatible.
85 my $cygdrive_present;
87 # Returns boolean true if Windows drives mounted with '/cygdrive/' prefix.
88 sub drives_mounted_on_cygdrive {
89 return $cygdrive_present if defined $cygdrive_present;
90 $cygdrive_present = ((-e '/cygdrive/') && (-d '/cygdrive/')) ? 1 : 0;
91 return $cygdrive_present;
92 }
95#######################################################################
96# Returns current working directory in Windows format on Windows.
98sub sys_native_current_path {
99 return Cwd::getcwd() if !os_is_win();
101 my $cur_dir;
102 if($^O eq 'MSWin32') {
103 $cur_dir = Cwd::getcwd();
104 }
105 else {
106 $cur_dir = Cygwin::posix_to_win_path(Cwd::getcwd());
107 }
108 $cur_dir =~ s{[/\\]+}{/}g;
109 return $cur_dir;
112#######################################################################
113# Converts given path to system native absolute path, i.e. to Windows
114# absolute format on Windows platform. Both relative and absolute
115# formats are supported for input.
117sub sys_native_abs_path {
118 my ($path) = @_;
120 # Return untouched on non-Windows platforms.
121 return File::Spec->rel2abs($path) if !os_is_win();
123 # Do not process empty path.
124 return $path if($path eq '');
126 my $res;
127 if($^O eq 'msys' || $^O eq 'cygwin') {
128 $res = Cygwin::posix_to_win_path(File::Spec->rel2abs($path));
129 }
130 elsif($path =~ m{^/(cygdrive/)?([a-z])/(.*)}) {
131 $res = uc($2) . ":/" . $3;
132 }
133 else {
134 $res = File::Spec->rel2abs($path);
135 }
137 $res =~ s{[/\\]+}{/}g;
138 return $res;
141#######################################################################
142# Converts given path to build system format absolute path, i.e. to
143# MSYS/Cygwin POSIX-style absolute format on Windows platform. Both
144# relative and absolute formats are supported for input.
146sub build_sys_abs_path {
147 my ($path) = @_;
149 # Return untouched on non-Windows platforms.
150 return File::Spec->rel2abs($path) if !os_is_win();
152 my $res;
153 if($^O eq 'msys' || $^O eq 'cygwin') {
154 $res = Cygwin::win_to_posix_path($path, 1);
155 }
156 else {
157 $res = File::Spec->rel2abs($path);
159 if($res =~ m{^([A-Za-z]):(.*)}) {
160 $res = "/" . lc($1) . $2;
161 $res = '/cygdrive' . $res if(drives_mounted_on_cygdrive());
162 }
163 }
165 return $res;
168#***************************************************************************
169# Return file extension for executable files on this operating system
171sub exe_ext {
172 my ($component, @arr) = @_;
173 if($ENV{'CURL_TEST_EXE_EXT'}) {
174 return $ENV{'CURL_TEST_EXE_EXT'};
175 }
176 if($ENV{'CURL_TEST_EXE_EXT_' . $component}) {
177 return $ENV{'CURL_TEST_EXE_EXT_' . $component};
178 }
179 if($^O eq 'MSWin32' || $^O eq 'cygwin' || $^O eq 'msys' ||
180 $^O eq 'dos' || $^O eq 'os2') {
181 return '.exe';
182 }
183 return '';
186#***************************************************************************
187# Add ending slash if missing
189sub dirsepadd {
190 my ($dir) = @_;
191 $dir =~ s/\/$//;
192 return $dir . '/';
195#######################################################################
196# Quote an argument for passing safely to a Bourne shell
197# This does the same thing as String::ShellQuote but does not need a package.
199sub shell_quote {
200 my ($s) = @_;
201 if($^O eq 'MSWin32') {
202 $s = '"' . $s . '"';
203 }
204 else {
205 if($s !~ m/^[-+=.,_\/:a-zA-Z0-9]+$/) {
206 # string contains a "dangerous" character--quote it
207 $s =~ s/'/'"'"'/g;
208 $s = "'" . $s . "'";
209 }
210 }
211 return $s;
2141; # End of module
Diagnostics4 git calls · 27 ms
CallStatusSizeTime027 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=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=21
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
fetch2002.5 KiB · hit21 ms
git.upload-pack fetch
http.response.status_code=200
git.response.bytes=2516
git.response.cache=HIT
git.response.duration_ms=21
git.fetch.wants=500e43f12576c629f63f7e3ab05c0dc8d8ed7372
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=2516
git.pkt.payload.max=2495
git.sideband.band1.bytes=2494
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
a5e1eb670d66452a
Request
357e8b2b…
Protocol
v2 · sha1
Agent
gitty/1.0
Filter
advertised
Fetch
shallow filter sideband-all
Capabilities
agent ls-refs fetch object-format