Artifactspublic-v0

curl

master
ply4 git calls54 ms290 KiB3 cachedprotocol v2
276 lines7.4 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 "curl_setup.h"
26#ifdef HAVE_NETINET_IN_H
27#include <netinet/in.h>
28#endif
29#ifdef HAVE_NETDB_H
30#include <netdb.h>
31#endif
32#ifdef HAVE_ARPA_INET_H
33#include <arpa/inet.h>
34#endif
35#ifdef __VMS
36#include <in.h>
37#include <inet.h>
38#endif
40#ifdef USE_ARES
41#include <ares.h>
42#endif
44#include "urldata.h"
45#include "connect.h"
46#include "curl_addrinfo.h"
47#include "curl_trc.h"
48#include "multiif.h"
49#include "progress.h"
50#include "select.h"
51#include "url.h"
52#include "vdns/hostip.h"
53#include "vdns/httpsrr.h"
55/***********************************************************************
56 * Only for builds using asynchronous name resolves
57 **********************************************************************/
58#ifdef CURLRES_ASYNCH
60timediff_t Curl_async_timeleft_ms(struct Curl_easy *data,
61 struct Curl_resolv_async *async)
63 if(async->timeout_ms) {
64 timediff_t elapsed_ms =
65 curlx_ptimediff_ms(Curl_pgrs_now(data), &async->start);
66 return async->timeout_ms - elapsed_ms;
67 }
68 return Curl_timeleft_ms(data);
71#ifdef USE_ARES
73#if ARES_VERSION < 0x011000
74#error "c-ares 1.16.0 or greater required"
75#endif
77/*
78 * Curl_ares_pollset() is called when the outside world (using
79 * curl_multi_fdset()) wants to get our fd_set setup and we are talking with
80 * ares. The caller must make sure that this function is only called when we
81 * have a working ares channel.
82 *
83 * Returns: sockets-in-use-bitmap
84 */
85CURLcode Curl_ares_pollset(struct Curl_easy *data,
86 ares_channel channel,
87 struct easy_pollset *ps)
89 curl_socket_t sockets[16]; /* ARES documented limit */
90 unsigned int bitmap, i;
91 CURLcode result = CURLE_OK;
93 DEBUGASSERT(channel);
94 if(!channel)
95 return CURLE_FAILED_INIT;
97 bitmap = ares_getsock(channel, (ares_socket_t *)sockets,
98 CURL_ARRAYSIZE(sockets));
99 for(i = 0; i < CURL_ARRAYSIZE(sockets); ++i) {
100 int flags = 0;
101 if(ARES_GETSOCK_READABLE(bitmap, i))
102 flags |= CURL_POLL_IN;
103 if(ARES_GETSOCK_WRITABLE(bitmap, i))
104 flags |= CURL_POLL_OUT;
105 if(!flags)
106 break;
107 result = Curl_pollset_change(data, ps, sockets[i], flags, 0);
108 if(result)
109 return result;
110 }
111 return result;
114timediff_t Curl_ares_timeout_ms(struct Curl_easy *data,
115 struct Curl_resolv_async *async,
116 ares_channel channel)
118 timediff_t async_timeout_ms;
120 DEBUGASSERT(channel);
121 if(!channel)
122 return -1;
124 async_timeout_ms = Curl_async_timeleft_ms(data, async);
125 if((async_timeout_ms > 0) && (async_timeout_ms < INT_MAX)) {
126 struct timeval timebuf;
127 struct timeval *timeout;
128 struct timeval end = { (int)async_timeout_ms / 1000,
129 ((int)async_timeout_ms % 1000) * 1000 };
131 timeout = ares_timeout(channel, &end, &timebuf);
132 if(timeout)
133 return curlx_tvtoms(timeout);
134 }
135 return async_timeout_ms;
138/*
139 * Curl_ares_perform()
140 *
141 * 1) Ask ares what sockets it currently plays with, then
142 * 2) wait for the timeout period to check for action on ares' sockets.
143 * 3) tell ares to act on all the sockets marked as "with action"
144 *
145 * return number of sockets it worked on, or -1 on error
146 */
147int Curl_ares_perform(ares_channel channel, timediff_t timeout_ms)
149 int nfds;
150 int bitmask;
151 ares_socket_t socks[ARES_GETSOCK_MAXNUM];
152 struct pollfd pfd[ARES_GETSOCK_MAXNUM];
153 int i;
154 int num = 0;
156 if(!channel)
157 return 0;
159 bitmask = ares_getsock(channel, socks, ARES_GETSOCK_MAXNUM);
161 for(i = 0; i < ARES_GETSOCK_MAXNUM; i++) {
162 pfd[i].events = 0;
163 pfd[i].revents = 0;
164 if(ARES_GETSOCK_READABLE(bitmask, i)) {
165 pfd[i].fd = socks[i];
166 pfd[i].events |= POLLRDNORM | POLLIN;
167 }
168 if(ARES_GETSOCK_WRITABLE(bitmask, i)) {
169 pfd[i].fd = socks[i];
170 pfd[i].events |= POLLWRNORM | POLLOUT;
171 }
172 if(pfd[i].events)
173 num++;
174 else
175 break;
176 }
178 if(num) {
179 nfds = Curl_poll(pfd, (unsigned int)num, timeout_ms);
180 if(nfds < 0)
181 return -1;
182 }
183 else
184 nfds = 0;
186 if(!nfds)
187 /* Call ares_process() unconditionally here, even if we timed out
188 above, as otherwise the ares name resolve will not timeout! */
189 ares_process_fd(channel, ARES_SOCKET_BAD, ARES_SOCKET_BAD);
190 else {
191 /* move through the descriptors and ask for processing on them */
192 for(i = 0; i < num; i++)
193 ares_process_fd(channel,
194 (pfd[i].revents & (POLLRDNORM | POLLIN)) ?
195 pfd[i].fd : ARES_SOCKET_BAD,
196 (pfd[i].revents & (POLLWRNORM | POLLOUT)) ?
197 pfd[i].fd : ARES_SOCKET_BAD);
198 }
199 return nfds;
202#endif /* USE_ARES */
204#endif /* CURLRES_ASYNCH */
206#ifdef USE_CURL_ASYNC
208#include "doh.h"
210void Curl_async_shutdown(struct Curl_easy *data,
211 struct Curl_resolv_async *async)
213 if(async) {
214 CURL_TRC_DNS(data, "[%u] shutdown async", async->id);
215 async->shutdown = TRUE;
216#ifdef USE_RESOLV_ARES
217 Curl_async_ares_shutdown(data, async);
218#endif
219#ifdef USE_RESOLV_THREADED
220 Curl_async_thrdd_shutdown(data, async);
221#endif
222#ifndef CURL_DISABLE_DOH
223 Curl_doh_cleanup(data, async);
224#endif
225 }
228void Curl_async_destroy(struct Curl_easy *data,
229 struct Curl_resolv_async *async)
231 if(async) {
232 CURL_TRC_DNS(data, "[%u] destroy async", async->id);
233 async->shutdown = TRUE;
234#ifdef USE_RESOLV_ARES
235 Curl_async_ares_destroy(data, async);
236#endif
237#ifdef USE_RESOLV_THREADED
238 Curl_async_thrdd_destroy(data, async);
239#endif
240#ifndef CURL_DISABLE_DOH
241 Curl_doh_cleanup(data, async);
242#endif
243 if(async->ai_A)
244 Curl_freeaddrinfo(async->ai_A);
245 if(async->ai_AAAA)
246 Curl_freeaddrinfo(async->ai_AAAA);
247#ifdef USE_HTTPSRR
248 Curl_httpsrr_destroy(async->httpsrr);
249#endif
250 Curl_peer_unlink(&async->peer);
251 curlx_safefree(async);
252 }
255CURLcode Curl_async_failed(struct Curl_easy *data,
256 struct Curl_resolv_async *async,
257 const char *detail)
259 const char *host_or_proxy = "host";
260 CURLcode result = CURLE_COULDNT_RESOLVE_HOST;
262#ifndef CURL_DISABLE_PROXY
263 if(async->for_proxy) {
264 host_or_proxy = "proxy";
265 result = CURLE_COULDNT_RESOLVE_PROXY;
266 }
267#endif
269 if(async->dns_queries & (CURL_DNSQ_A | CURL_DNSQ_AAAA))
270 failf(data, "Could not resolve %s: %s%s%s%s",
271 host_or_proxy, async->peer->hostname,
272 detail ? " (" : "", detail ? detail : "", detail ? ")" : "");
273 return result;
276#endif /* USE_CURL_ASYNC */
Diagnostics4 git calls · 54 ms
CallStatusSizeTime054 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 · hit26 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=26
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.7 KiB · hit26 ms
git.upload-pack fetch
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=fetch
git.upstream.dur_ms=26
git.response.bytes=2729
git.response.cache=HIT
git.response.duration_ms=26
git.fetch.wants=f3db691c8c4dece88780f725379c00f0fde2c970
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=2729
git.pkt.payload.max=2708
git.sideband.band1.bytes=2707
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
a5e9ef8cfec80acb
Request
8afabe0f…
Protocol
v2 · sha1
Agent
gitty/1.0
Filter
advertised
Fetch
shallow filter sideband-all
Capabilities
agent ls-refs fetch object-format