Artifactspublic-v0

curl

master
ply4 git calls22 ms289 KiB3 cachedprotocol v2
197 lines5.2 KiBRaw
1/***************************************************************************
2 * _ _ ____ _
3 * Project ___| | | | _ \| |
4 * / __| | | | |_) | |
5 * | (__| |_| | _ <| |___
6 * \___|\___/|_| \_\_____|
7 *
8 * Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
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.
13 *
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.
17 *
18 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19 * KIND, either express or implied.
20 *
21 * SPDX-License-Identifier: curl
22 *
23 ***************************************************************************/
24#include "tool_setup.h"
26#if defined(__AMIGA__) && !defined(__amigaos4__)
27# undef HAVE_TERMIOS_H
28#endif
30#ifndef HAVE_GETPASS_R
31/* this file is only for systems without getpass_r() */
33#ifdef HAVE_TERMIOS_H
34# include <termios.h>
35#elif defined(HAVE_TERMIO_H)
36# include <termio.h>
37#endif
39#ifdef __VMS
40# include descrip
41# include starlet
42# include iodef
43#endif
45#ifdef _WIN32
46# include <conio.h>
47#endif
49#ifdef HAVE_UNISTD_H
50#include <unistd.h>
51#endif
52#include "tool_getpass.h"
54#ifdef __VMS
55/* VMS implementation */
56char *getpass_r(const char *prompt, char *buffer, size_t buflen)
58 long sts;
59 short chan;
61 /* iosbdef.h was not in VAX v7.2 or CC 6.4 */
62 struct _isb {
63 short int iosb$w_status; /* status */
64 short int iosb$w_bcnt; /* byte count */
65 int unused; /* unused */
66 } iosb;
68 $DESCRIPTOR(ttdesc, "TT");
70 buffer[0] = '\0';
71 sts = sys$assign(&ttdesc, &chan, 0, 0);
72 if(sts & 1) {
73 sts = sys$qiow(0, chan,
74 IO$_READPROMPT | IO$M_NOECHO,
75 &iosb, 0, 0, buffer, buflen, 0, 0,
76 prompt, strlen(prompt));
78 if((sts & 1) && (iosb.iosb$w_status & 1))
79 buffer[iosb.iosb$w_bcnt] = '\0';
81 sys$dassgn(chan);
82 }
83 return buffer; /* we always return success */
85#define DONE
86#endif /* __VMS */
88#ifdef _WIN32
89char *getpass_r(const char *prompt, char *buffer, size_t buflen)
91 size_t i;
92 fputs(prompt, tool_stderr);
94 for(i = 0; i < buflen; i++) {
95 buffer[i] = (char)_getch();
96 if(buffer[i] == '\r' || buffer[i] == '\n') {
97 buffer[i] = '\0';
98 break;
99 }
100 else if(buffer[i] == '\b')
101 /* remove this letter and if this is not the first key, remove the
102 previous one as well */
103 i = i - (i >= 1 ? 2 : 1);
104 }
105 /* since echo is disabled, print a newline */
106 fputs("\n", tool_stderr);
107 /* if user did not hit ENTER, terminate buffer */
108 if(i == buflen)
109 buffer[buflen - 1] = '\0';
111 return buffer; /* we always return success */
113#define DONE
114#endif /* _WIN32 */
116#ifndef DONE /* not previously provided */
118#ifdef HAVE_TERMIOS_H
119# define struct_term struct termios
120#elif defined(HAVE_TERMIO_H)
121# define struct_term struct termio
122#else
123# undef struct_term
124#endif
126static bool ttyecho(bool enable, int fd)
128#ifdef struct_term
129 static struct_term withecho;
130 static struct_term noecho;
131#endif
132 if(!enable) {
133 /* disable echo by extracting the current 'withecho' mode and remove the
134 ECHO bit and set back the struct */
135#ifdef HAVE_TERMIOS_H
136 tcgetattr(fd, &withecho);
137 noecho = withecho;
138 noecho.c_lflag &= ~(tcflag_t)ECHO;
139 tcsetattr(fd, TCSANOW, &noecho);
140#elif defined(HAVE_TERMIO_H)
141 ioctl(fd, TCGETA, &withecho);
142 noecho = withecho;
143 noecho.c_lflag &= ~(tcflag_t)ECHO;
144 ioctl(fd, TCSETA, &noecho);
145#else
146 /* neither HAVE_TERMIO_H nor HAVE_TERMIOS_H, we cannot disable echo! */
147 (void)fd;
148 return FALSE; /* not disabled */
149#endif
150 return TRUE; /* disabled */
151 }
152 /* re-enable echo, assumes we disabled it before (and set the structs we
153 now use to reset the terminal status) */
154#ifdef HAVE_TERMIOS_H
155 tcsetattr(fd, TCSAFLUSH, &withecho);
156#elif defined(HAVE_TERMIO_H)
157 ioctl(fd, TCSETA, &withecho);
158#else
159 return FALSE; /* not enabled */
160#endif
161 return TRUE; /* enabled */
164char *getpass_r(const char *prompt, /* prompt to display */
165 char *buffer, /* buffer to store password in */
166 size_t buflen) /* size of buffer to store password in */
168 ssize_t nread;
169 bool disabled;
170 int fd = curlx_open("/dev/tty", O_RDONLY);
171 if(fd == -1)
172 fd = STDIN_FILENO; /* use stdin if the tty could not be used */
174 disabled = ttyecho(FALSE, fd); /* disable terminal echo */
176 fputs(prompt, tool_stderr);
177 nread = read(fd, buffer, buflen - 1);
178 if(nread < 0)
179 nread = 0; /* got nothing */
180 else if(nread && (buffer[nread - 1] == '\n'))
181 nread--; /* remove the newline from pressing enter */
182 buffer[nread] = '\0';
184 if(disabled) {
185 /* if echo actually was disabled, add a newline */
186 fputs("\n", tool_stderr);
187 (void)ttyecho(TRUE, fd); /* enable echo */
188 }
190 if(STDIN_FILENO != fd)
191 curlx_close(fd);
193 return buffer; /* return pointer to buffer */
196#endif /* DONE */
197#endif /* HAVE_GETPASS_R */
Diagnostics4 git calls · 22 ms
CallStatusSizeTime022 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=1
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 · hit1 ms
git.upload-pack fetch
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=fetch
git.upstream.dur_ms=18
git.response.bytes=293470
git.response.cache=HIT
git.response.duration_ms=1
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 KiB · hit18 ms
git.upload-pack fetch
http.response.status_code=200
git.response.bytes=2185
git.response.cache=HIT
git.response.duration_ms=18
git.fetch.wants=ae81355e6c1a709d5fa76503c2b96967e7d26cf7
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=2185
git.pkt.payload.max=2164
git.sideband.band1.bytes=2163
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
a5e1f9d6f9a724ce
Request
79dd4ce6…
Protocol
v2 · sha1
Agent
gitty/1.0
Filter
advertised
Fetch
shallow filter sideband-all
Capabilities
agent ls-refs fetch object-format