Artifactspublic-v0

curl

master
ply4 git calls24 ms290 KiB3 cachedprotocol v2
271 lines9.2 KiBRaw
1#ifndef HEADER_CURL_ASYN_H
2#define HEADER_CURL_ASYN_H
3/***************************************************************************
4 * _ _ ____ _
5 * Project ___| | | | _ \| |
6 * / __| | | | |_) | |
7 * | (__| |_| | _ <| |___
8 * \___|\___/|_| \_\_____|
9 *
10 * Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
11 *
12 * This software is licensed as described in the file COPYING, which
13 * you should have received as part of this distribution. The terms
14 * are also available at https://curl.se/docs/copyright.html.
15 *
16 * You may opt to use, copy, modify, merge, publish, distribute and/or sell
17 * copies of the Software, and permit persons to whom the Software is
18 * furnished to do so, under the terms of the COPYING file.
19 *
20 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
21 * KIND, either express or implied.
22 *
23 * SPDX-License-Identifier: curl
24 *
25 ***************************************************************************/
26#include "curl_setup.h"
28#if defined(USE_HTTPSRR) && defined(USE_ARES)
29#include "vdns/httpsrr.h"
30#endif
32struct Curl_easy;
33struct Curl_dns_entry;
34struct Curl_resolv_async;
35struct Curl_multi;
36struct easy_pollset;
38#ifdef CURLRES_ASYNCH
40#include "curl_addrinfo.h"
42struct hostent;
43struct connectdata;
44struct easy_pollset;
46#if defined(USE_RESOLV_ARES) && defined(USE_RESOLV_THREADED)
47#error cannot have both USE_RESOLV_ARES and USE_RESOLV_THREADED defined
48#endif
50/*
51 * This header defines all functions in the internal asynch resolver interface.
52 * All asynch resolvers need to provide these functions.
53 * asyn-ares.c and asyn-thread.c are the current implementations of asynch
54 * resolver backends.
55 */
57/*
58 * Curl_async_global_init()
59 *
60 * Called from curl_global_init() to initialize global resolver environment.
61 * Returning anything else than CURLE_OK fails curl_global_init().
62 */
63int Curl_async_global_init(void);
65/*
66 * Curl_async_global_cleanup()
67 * Called from curl_global_cleanup() to destroy global resolver environment.
68 */
69void Curl_async_global_cleanup(void);
71/*
72 * Curl_async_getaddrinfo() - when using this resolver
73 *
74 * Returns name information about the given hostname and port number. If
75 * successful, the 'hostent' is returned and the fourth argument will point to
76 * memory we need to free after use. That memory *MUST* be freed with
77 * Curl_freeaddrinfo(), nothing else.
78 *
79 * Each resolver backend must of course make sure to return data in the
80 * correct format to comply with this.
81 */
82CURLcode Curl_async_getaddrinfo(struct Curl_easy *data,
83 struct Curl_resolv_async *async);
85#ifdef USE_HTTPSRR
86bool Curl_async_knows_https(struct Curl_easy *data,
87 struct Curl_resolv_async *async);
88#endif /* USE_HTTPSRR */
90#ifdef USE_ARES
91/* common functions for c-ares and threaded resolver with HTTPSRR */
92#include <ares.h>
94CURLcode Curl_ares_pollset(struct Curl_easy *data,
95 ares_channel channel,
96 struct easy_pollset *ps);
98timediff_t Curl_ares_timeout_ms(struct Curl_easy *data,
99 struct Curl_resolv_async *async,
100 ares_channel channel);
102int Curl_ares_perform(ares_channel channel, timediff_t timeout_ms);
103#endif
105#ifdef USE_RESOLV_ARES
106/* async resolving implementation using c-ares alone */
107struct async_ares_ctx {
108 ares_channel channel;
109 int ares_status; /* ARES_SUCCESS, ARES_ENOTFOUND, etc. */
110 CURLcode result; /* CURLE_OK or error handling response */
111 BIT(transient_err); /* an A/AAAA query failed without the resolver
112 answering that the name does not exist */
113};
115void Curl_async_ares_shutdown(struct Curl_easy *data,
116 struct Curl_resolv_async *async);
117void Curl_async_ares_destroy(struct Curl_easy *data,
118 struct Curl_resolv_async *async);
120#endif /* USE_RESOLV_ARES */
122#ifdef USE_RESOLV_THREADED
124struct async_thrdd_item;
126/* Context for threaded resolver */
127struct async_thrdd_ctx {
128 struct async_thrdd_item *res_A; /* IPv4 final result */
129 struct async_thrdd_item *res_AAAA; /* IPv6 final result */
130#if defined(USE_HTTPSRR) && defined(USE_ARES)
131 struct {
132 ares_channel channel;
133 } rr;
134#endif
135 BIT(processed_A);
136 BIT(processed_AAAA);
137};
139void Curl_async_thrdd_shutdown(struct Curl_easy *data,
140 struct Curl_resolv_async *async);
141void Curl_async_thrdd_destroy(struct Curl_easy *data,
142 struct Curl_resolv_async *async);
144CURLcode Curl_async_thrdd_multi_init(struct Curl_multi *multi,
145 uint32_t min_threads,
146 uint32_t max_threads,
147 uint32_t idle_time_ms);
148void Curl_async_thrdd_multi_destroy(struct Curl_multi *multi, bool join);
149void Curl_async_thrdd_multi_process(struct Curl_multi *multi);
151CURLcode Curl_async_thrdd_multi_set_props(struct Curl_multi *multi,
152 uint32_t min_threads,
153 uint32_t max_threads,
154 uint32_t idle_time_ms);
156#endif /* USE_RESOLV_THREADED */
158#ifndef CURL_DISABLE_DOH
159struct doh_probes;
160#endif
162/*
163 * Curl_async_await()
164 *
165 * Waits for a resolve to finish. This function should be avoided since using
166 * this risk getting the multi interface to "hang".
167 *
168 * On return 'dns' is assigned the resolved dns (CURLE_OK or NULL otherwise.
169 *
170 * Returns CURLE_COULDNT_RESOLVE_HOST if the host was not resolved,
171 * CURLE_OPERATION_TIMEDOUT if a time-out occurred, or other errors.
172 */
173CURLcode Curl_async_await(struct Curl_easy *data, uint32_t resolv_id,
174 struct Curl_dns_entry **pdns);
176/*
177 * Take the result of an async resolve operation.
178 * Returns CURLE_OK with `*pdns` != NULL, CURLE_AGAIN while still
179 * ongoing or an error code for a failed resolve.
180 */
181CURLcode Curl_async_take_result(struct Curl_easy *data,
182 struct Curl_resolv_async *async,
183 struct Curl_dns_entry **pdns);
185/* Curl_async_pollset()
186 *
187 * This function is called from the Curl_multi_pollset() function. 'sock' is a
188 * pointer to an array to hold the file descriptors, with 'numsock' being the
189 * size of that array (in number of entries). This function is supposed to
190 * return bitmask indicating what file descriptors (referring to array indexes
191 * in the 'sock' array) to wait for, read/write.
192 */
193CURLcode Curl_async_pollset(struct Curl_easy *data,
194 struct Curl_resolv_async *async,
195 struct easy_pollset *ps);
197#else /* CURLRES_ASYNCH */
199/* convert these functions if an asynch resolver is not used */
200#define Curl_async_global_init() CURLE_OK
201#define Curl_async_global_cleanup() Curl_nop_stmt
202#define Curl_async_await(a, b, c) CURLE_COULDNT_RESOLVE_HOST
203#define Curl_async_take_result(x, y, z) CURLE_COULDNT_RESOLVE_HOST
204#define Curl_async_pollset(x, y, z) CURLE_OK
205#define Curl_async_knows_https(x, y) TRUE
206#endif /* !CURLRES_ASYNCH */
208#if defined(CURLRES_ASYNCH) || !defined(CURL_DISABLE_DOH)
209#define USE_CURL_ASYNC
210#endif
212#ifdef USE_CURL_ASYNC
214struct Curl_resolv_async {
215 struct Curl_resolv_async *next;
216 struct Curl_peer *peer;
217 struct Curl_addrinfo *ai_A;
218 struct Curl_addrinfo *ai_AAAA;
219#ifdef USE_HTTPSRR
220 struct Curl_https_rrinfo *httpsrr;
221#endif
222#ifdef USE_RESOLV_ARES
223 struct async_ares_ctx ares;
224#elif defined(USE_RESOLV_THREADED)
225 struct async_thrdd_ctx thrdd;
226#endif
227#ifndef CURL_DISABLE_DOH
228 struct doh_probes *doh; /* DoH specific data for this request */
229#endif
230 struct curltime start;
231 timediff_t interval_end;
232 timediff_t timeout_ms;
233 CURLcode result;
234 uint32_t poll_interval;
235 uint32_t id; /* unique id per easy handle of the resolve operation */
236 uint8_t dns_queries; /* what queries are being performed */
237 uint8_t dns_responses; /* what queries had responses so far. */
238 uint8_t transport;
239 uint8_t queries_ongoing;
240 BIT(is_ipaddr);
241 BIT(is_ipv4addr);
242 BIT(for_proxy);
243 BIT(done);
244 BIT(shutdown);
245 BIT(negative_answer); /* resolver answered that the name does not
246 exist. Only such failures may be cached as
247 negative entries, not transient or local
248 resolver failures. */
249};
251timediff_t Curl_async_timeleft_ms(struct Curl_easy *data,
252 struct Curl_resolv_async *async);
254/* Shut down the given async resolve. */
255void Curl_async_shutdown(struct Curl_easy *data,
256 struct Curl_resolv_async *async);
258/* Frees the resources of the given async resolve and the struct itself. */
259void Curl_async_destroy(struct Curl_easy *data,
260 struct Curl_resolv_async *async);
262CURLcode Curl_async_failed(struct Curl_easy *data,
263 struct Curl_resolv_async *async,
264 const char *detail);
266#else /* !USE_CURL_ASYNC */
267#define Curl_async_shutdown(x, y) Curl_nop_stmt
268#endif /* USE_CURL_ASYNC */
270/********** end of generic resolver interface functions *****************/
271#endif /* HEADER_CURL_ASYN_H */
Diagnostics4 git calls · 24 ms
CallStatusSizeTime024 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 · hit3 ms
git.upload-pack fetch
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=fetch
git.upstream.dur_ms=3
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.8 KiB · hit19 ms
git.upload-pack fetch
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=fetch
git.upstream.dur_ms=19
git.response.bytes=2898
git.response.cache=HIT
git.response.duration_ms=19
git.fetch.wants=7eade656a52bc8df7271d28b48a091a5b3b6e00d
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=2898
git.pkt.payload.max=2877
git.sideband.band1.bytes=2876
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
a5e9efaf8b8e0acb
Request
6079e645…
Protocol
v2 · sha1
Agent
gitty/1.0
Filter
advertised
Fetch
shallow filter sideband-all
Capabilities
agent ls-refs fetch object-format