Artifactspublic-v0

curl

master
ply4 git calls97 ms293 KiB3 cachedprotocol v2
769 lines23 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#include "http_proxy.h"
28#if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_PROXY)
30#include "curl_trc.h"
31#include "http.h"
32#include "url.h"
33#include "cfilters.h"
34#include "cf-h1-proxy.h"
35#include "cf-h2-proxy.h"
36#include "connect.h"
37#include "vauth/vauth.h"
38#include "vquic/vquic.h"
39#include "curlx/strparse.h"
41static CURLcode dynhds_add_custom(struct Curl_easy *data,
42 bool is_connect, int httpversion,
43 bool is_udp, struct dynhds *hds)
45 struct connectdata *conn = data->conn;
46 struct curl_slist *h[2];
47 struct curl_slist *headers;
48 int numlists = 1; /* by default */
49 int i;
51 enum Curl_proxy_use proxy;
53 if(is_connect && !is_udp)
54 proxy = HEADER_CONNECT;
55 else if(is_connect && is_udp)
56 proxy = HEADER_CONNECT_UDP;
57 else
58 proxy = conn->bits.origin_is_proxy ? HEADER_PROXY : HEADER_SERVER;
60 switch(proxy) {
61 case HEADER_SERVER:
62 h[0] = data->set.headers;
63 break;
64 case HEADER_PROXY:
65 h[0] = data->set.headers;
66 if(data->set.sep_headers) {
67 h[1] = data->set.proxyheaders;
68 numlists++;
69 }
70 break;
71 case HEADER_CONNECT:
72 if(data->set.sep_headers)
73 h[0] = data->set.proxyheaders;
74 else
75 h[0] = data->set.headers;
76 break;
77 case HEADER_CONNECT_UDP:
78 if(data->set.sep_headers)
79 h[0] = data->set.proxyheaders;
80 else
81 h[0] = data->set.headers;
82 break;
83 }
85 /* loop through one or two lists */
86 for(i = 0; i < numlists; i++) {
87 for(headers = h[i]; headers; headers = headers->next) {
88 struct Curl_str name;
89 const char *value = NULL;
90 size_t valuelen = 0;
91 const char *ptr = headers->data;
93 /* There are 2 quirks in place for custom headers:
94 * 1. setting only 'name:' to suppress a header from being sent
95 * 2. setting only 'name;' to send an empty (illegal) header
96 */
97 if(!curlx_str_cspn(&ptr, &name, ";:")) {
98 if(!curlx_str_single(&ptr, ':')) {
99 curlx_str_passblanks(&ptr);
100 if(*ptr) {
101 value = ptr;
102 valuelen = strlen(value);
103 }
104 else {
105 /* quirk #1, suppress this header */
106 continue;
107 }
108 }
109 else if(!curlx_str_single(&ptr, ';')) {
110 curlx_str_passblanks(&ptr);
111 if(!*ptr) {
112 /* quirk #2, send an empty header */
113 value = "";
114 valuelen = 0;
115 }
116 else {
117 /* this may be used for something else in the future,
118 * ignore this for now */
119 continue;
120 }
121 }
122 else
123 /* neither : nor ; in provided header value. We ignore this
124 * silently */
125 continue;
126 }
127 else
128 /* no name, move on */
129 continue;
131 DEBUGASSERT(curlx_strlen(&name) && value);
132 /* trim surrounding whitespace so a padded field name (e.g.
133 `Authorization :`) cannot slip past the Authorization/Cookie check */
134 curlx_str_trimblanks(&name);
135 if(!curlx_strlen(&name))
136 continue;
137 if(data->state.http_host &&
138 /* a Host: header was sent already, do not pass on any custom Host:
139 header as that will produce *two* in the same request! */
140 curlx_str_casecompare(&name, "Host"))
141 ;
142 else if(data->state.httpreq == HTTPREQ_POST_FORM &&
143 /* this header (extended by formdata.c) is sent later */
144 curlx_str_casecompare(&name, "Content-Type"))
145 ;
146 else if(data->state.httpreq == HTTPREQ_POST_MIME &&
147 /* this header is sent later */
148 curlx_str_casecompare(&name, "Content-Type"))
149 ;
150 else if(data->req.authneg &&
151 /* while doing auth neg, do not allow the custom length since
152 we will force length zero then */
153 curlx_str_casecompare(&name, "Content-Length"))
154 ;
155 else if((httpversion >= 20) &&
156 curlx_str_casecompare(&name, "Transfer-Encoding"))
157 ;
158 /* HTTP/2 and HTTP/3 do not support chunked requests */
159 else if((curlx_str_casecompare(&name, "Authorization") ||
160 curlx_str_casecompare(&name, "Cookie")) &&
161 /* be careful of sending this potentially sensitive header to
162 other hosts */
163 !Curl_auth_allowed_to_host(data))
164 ;
165 else {
166 CURLcode result =
167 Curl_dynhds_add(hds, curlx_str(&name), curlx_strlen(&name),
168 value, valuelen);
169 if(result)
170 return result;
171 }
172 }
173 }
175 return CURLE_OK;
178struct cf_proxy_ctx {
179 struct Curl_peer *peer; /* proxy */
180 struct Curl_peer *tunnel_peer; /* tunnel destination */
181 uint8_t proxytype;
182 uint8_t tunnel_transport;
183 BIT(sub_filter_installed);
184};
186static int proxy_http_ver_major(proxy_http_ver ver)
188 switch(ver) {
189 case PROXY_HTTP_V1:
190 return 11;
191 case PROXY_HTTP_V2:
192 return 20;
193 case PROXY_HTTP_V3:
194 return 30;
195 }
196 return 0;
199static CURLcode http_proxy_create_CONNECT(struct httpreq **preq,
200 struct Curl_cfilter *cf,
201 struct Curl_easy *data,
202 struct Curl_peer *peer,
203 struct Curl_peer *dest,
204 proxy_http_ver ver)
206 char *authority = NULL;
207 const char *ua;
208 int httpversion = proxy_http_ver_major(ver);
209 CURLcode result;
210 struct httpreq *req = NULL;
212 (void)peer;
213 authority = curl_maprintf("%s%s%s:%u",
214 dest->ipv6 ? "[" : "",
215 dest->hostname,
216 dest->ipv6 ? "]" : "",
217 dest->port);
218 if(!authority) {
219 result = CURLE_OUT_OF_MEMORY;
220 goto out;
221 }
223 result = Curl_http_req_make(&req, STRCONST("CONNECT"),
224 NULL, 0, authority, strlen(authority),
225 NULL, 0);
226 if(result)
227 goto out;
229 /* Setup the proxy-authorization header, if any */
230 result = Curl_http_output_auth(data, cf->conn, req->method, HTTPREQ_GET,
231 req->authority, NULL, TRUE);
232 if(result)
233 goto out;
235 /* If user is not overriding Host: header, we add for HTTP/1.x */
236 if(ver == PROXY_HTTP_V1 &&
237 !Curl_checkProxyheaders(data, cf->conn, STRCONST("Host"))) {
238 result = Curl_dynhds_cadd(&req->headers, "Host", authority);
239 if(result)
240 goto out;
241 }
243 if(data->req.hd_proxy_auth) {
244 result = Curl_dynhds_h1_cadd_line(&req->headers,
245 data->req.hd_proxy_auth);
246 if(result)
247 goto out;
248 }
250 ua = CURL_EASY_STR(data, STRING_USERAGENT);
251 if(!Curl_checkProxyheaders(data, cf->conn, STRCONST("User-Agent")) &&
252 ua && *ua) {
253 result = Curl_dynhds_cadd(&req->headers, "User-Agent", ua);
254 if(result)
255 goto out;
256 }
258 if(ver == PROXY_HTTP_V1 &&
259 !Curl_checkProxyheaders(data, cf->conn, STRCONST("Proxy-Connection"))) {
260 result = Curl_dynhds_cadd(&req->headers, "Proxy-Connection", "Keep-Alive");
261 if(result)
262 goto out;
263 }
265 result = dynhds_add_custom(data, TRUE, httpversion,
266 FALSE, &req->headers);
268out:
269 if(result && req) {
270 Curl_http_req_free(req);
271 req = NULL;
272 }
273 curlx_free(authority);
274 *preq = req;
275 return result;
278static CURLcode http_proxy_create_CONNECTUDP(struct httpreq **preq,
279 struct Curl_cfilter *cf,
280 struct Curl_easy *data,
281 struct Curl_peer *peer,
282 struct Curl_peer *dest,
283 proxy_http_ver ver)
285 const char *proxy_scheme = "http", *ua;
286 int httpversion = proxy_http_ver_major(ver);
287 char *authority = NULL;
288 char *path = NULL;
289 char *encoded_host = NULL;
290 struct httpreq *req = NULL;
291 CURLcode result;
293 if(cf->conn->http_proxy.proxytype == CURLPROXY_HTTPS ||
294 cf->conn->http_proxy.proxytype == CURLPROXY_HTTPS2 ||
295 cf->conn->http_proxy.proxytype == CURLPROXY_HTTPS3)
296 proxy_scheme = "https";
298 authority = curl_maprintf("%s%s%s:%d",
299 peer->ipv6 ? "[" : "",
300 peer->hostname,
301 peer->ipv6 ? "]" : "",
302 peer->port);
303 if(!authority) {
304 result = CURLE_OUT_OF_MEMORY;
305 goto out;
306 }
308 if(dest->ipv6) {
309 /* RFC 9298: colons in IPv6 addresses MUST be percent-encoded
310 * in the URI template (e.g. "2001:db8::1" -> "2001%3Adb8%3A%3A1") */
311 const char *s = dest->hostname;
312 char *d;
313 size_t hlen = strlen(s);
314 encoded_host = curlx_malloc(hlen * 3 + 1);
315 if(!encoded_host) {
316 result = CURLE_OUT_OF_MEMORY;
317 goto out;
318 }
319 d = encoded_host;
320 while(*s) {
321 if(*s == ':') {
322 *d++ = '%';
323 *d++ = '3';
324 *d++ = 'A';
325 }
326 else
327 *d++ = *s;
328 s++;
329 }
330 *d = '\0';
331 path = curl_maprintf("/.well-known/masque/udp/%s/%u/",
332 encoded_host, (unsigned int)dest->port);
333 }
334 else {
335 path = curl_maprintf("/.well-known/masque/udp/%s/%u/",
336 dest->hostname, (unsigned int)dest->port);
337 }
339 if(!path) {
340 result = CURLE_OUT_OF_MEMORY;
341 goto out;
342 }
344 if(ver == PROXY_HTTP_V1) {
345 result = Curl_http_req_make(&req, "GET", CURL_CSTRLEN("GET"),
346 proxy_scheme, strlen(proxy_scheme),
347 authority, strlen(authority),
348 path, strlen(path));
349 if(result)
350 goto out;
351 }
352 else if(ver == PROXY_HTTP_V2 || ver == PROXY_HTTP_V3) {
353 result = Curl_http_req_make(&req, STRCONST("CONNECT"),
354 proxy_scheme, strlen(proxy_scheme),
355 authority, strlen(authority),
356 path, strlen(path));
357 if(result)
358 goto out;
359 }
360 else {
361 result = CURLE_FAILED_INIT;
362 goto out;
363 }
365 /* Setup the proxy-authorization header, if any */
366 result = Curl_http_output_auth(data, cf->conn, req->method, HTTPREQ_GET,
367 req->authority, NULL, TRUE);
368 if(result)
369 goto out;
371 /* If user is not overriding Host: header, we add for HTTP/1.x */
372 if(ver == PROXY_HTTP_V1 &&
373 !Curl_checkProxyheaders(data, cf->conn, STRCONST("Host"))) {
374 result = Curl_dynhds_cadd(&req->headers, "Host", authority);
375 if(result)
376 goto out;
377 }
379 if(data->req.hd_proxy_auth) {
380 result = Curl_dynhds_h1_cadd_line(&req->headers,
381 data->req.hd_proxy_auth);
382 if(result)
383 goto out;
384 }
386 ua = CURL_EASY_STR(data, STRING_USERAGENT);
387 if(ver == PROXY_HTTP_V1 &&
388 !Curl_checkProxyheaders(data, cf->conn, STRCONST("User-Agent")) &&
389 ua && *ua) {
390 result = Curl_dynhds_cadd(&req->headers, "User-Agent", ua);
391 if(result)
392 goto out;
393 }
395 if(ver == PROXY_HTTP_V1 &&
396 !Curl_checkProxyheaders(data, cf->conn, STRCONST("Proxy-Connection"))) {
397 result = Curl_dynhds_cadd(&req->headers, "Proxy-Connection", "Keep-Alive");
398 if(result)
399 goto out;
400 }
402 if(ver == PROXY_HTTP_V1) {
403 result = Curl_dynhds_cadd(&req->headers, "Connection", "Upgrade");
404 if(result)
405 goto out;
407 result = Curl_dynhds_cadd(&req->headers, "Upgrade", "connect-udp");
408 if(result)
409 goto out;
411 result = Curl_dynhds_cadd(&req->headers, "Capsule-Protocol", "?1");
412 if(result)
413 goto out;
414 }
415 else {
416 result = Curl_dynhds_cadd(&req->headers, ":Protocol", "connect-udp");
417 if(result)
418 goto out;
420 if(ver >= PROXY_HTTP_V2) {
421 result = Curl_dynhds_cadd(&req->headers, "Capsule-Protocol", "?1");
422 if(result)
423 goto out;
424 }
425 }
427 result = dynhds_add_custom(data, TRUE, httpversion,
428 TRUE, &req->headers);
430out:
431 if(result && req) {
432 Curl_http_req_free(req);
433 req = NULL;
434 }
435 curlx_free(authority);
436 curlx_free(path);
437 curlx_free(encoded_host);
438 *preq = req;
439 return result;
442CURLcode Curl_http_proxy_create_tunnel_request(
443 struct httpreq **preq, struct Curl_cfilter *cf,
444 struct Curl_easy *data, struct Curl_peer *peer, struct Curl_peer *dest,
445 proxy_http_ver ver, bool udp_tunnel)
447 CURLcode result = udp_tunnel ?
448 http_proxy_create_CONNECTUDP(preq, cf, data, peer, dest, ver) :
449 http_proxy_create_CONNECT(preq, cf, data, peer, dest, ver);
450 if(result)
451 return result;
453 infof(data, "Establishing %s proxy %stunnel to %s:%u",
454 (ver == PROXY_HTTP_V2) ? "HTTP/2" :
455 (ver == PROXY_HTTP_V3) ? "HTTP/3" : "HTTP",
456 udp_tunnel ? "UDP " : "",
457 dest->user_hostname, dest->port);
458 return CURLE_OK;
461CURLcode Curl_http_proxy_inspect_tunnel_response(
462 struct Curl_cfilter *cf, struct Curl_easy *data,
463 struct http_resp *resp, bool udp_tunnel,
464 proxy_inspect_result *presult)
466 struct dynhds_entry *capsule_protocol = NULL;
467 struct dynhds_entry *auth_reply = NULL;
468 size_t i, header_count;
469 CURLcode result = CURLE_OK;
471 DEBUGASSERT(resp);
473 header_count = Curl_dynhds_count(&resp->headers);
474 infof(data, "CONNECT%s Response Status %d",
475 udp_tunnel ? "-UDP" : "", resp->status);
476 infof(data, "Response Headers (%zu total):", header_count);
477 for(i = 0; i < header_count; i++) {
478 struct dynhds_entry *entry = Curl_dynhds_getn(&resp->headers, i);
479 if(entry)
480 infof(data, " %s: %s", entry->name, entry->value);
481 }
483 if(resp->status == 407) {
484 auth_reply = Curl_dynhds_cget(&resp->headers, "Proxy-Authenticate");
485 }
487 if(auth_reply) {
488 CURL_TRC_CF(data, cf, "[0] CONNECT%s: fwd auth header '%s'",
489 udp_tunnel ? "-UDP" : "", auth_reply->value);
490 result = Curl_http_input_auth(data, resp->status == 407,
491 auth_reply->value);
492 if(result)
493 return result;
494 if(data->req.newurl) {
495 curlx_safefree(data->req.newurl);
496 *presult = PROXY_INSPECT_AUTH_RETRY;
497 return CURLE_OK;
498 }
499 }
501 if(udp_tunnel) {
502 if(resp->status / 100 == 2) {
503 capsule_protocol = Curl_dynhds_cget(&resp->headers,
504 "capsule-protocol");
505 if(capsule_protocol) {
506 if(!strncmp(capsule_protocol->value, "?1", 2) &&
507 !capsule_protocol->value[2]) {
508 infof(data, "CONNECT-UDP tunnel established, response %d",
509 resp->status);
510 *presult = PROXY_INSPECT_OK;
511 return CURLE_OK;
512 }
513 failf(data, "Failed to establish CONNECT-UDP tunnel, response %d, "
514 "unsupported capsule-protocol value '%s'",
515 resp->status, capsule_protocol->value);
516 *presult = PROXY_INSPECT_FAILED;
517 return CURLE_COULDNT_CONNECT;
518 }
519 else {
520 /* NOTE proxies may not set capsule protocol in the headers */
521 infof(data, "CONNECT-UDP tunnel established, response %d "
522 "but no capsule-protocol header found", resp->status);
523 *presult = PROXY_INSPECT_OK;
524 return CURLE_OK;
525 }
526 }
527 else {
528 failf(data, "Failed to establish CONNECT-UDP tunnel, "
529 "response %d", resp->status);
530 *presult = PROXY_INSPECT_FAILED;
531 return CURLE_COULDNT_CONNECT;
532 }
533 }
535 if(resp->status / 100 == 2) {
536 infof(data, "CONNECT tunnel established, response %d", resp->status);
537 *presult = PROXY_INSPECT_OK;
538 return CURLE_OK;
539 }
541 *presult = PROXY_INSPECT_FAILED;
542 return CURLE_COULDNT_CONNECT;
545static CURLcode http_proxy_cf_connect(struct Curl_cfilter *cf,
546 struct Curl_easy *data,
547 bool *done)
549 struct cf_proxy_ctx *ctx = cf->ctx;
550 CURLcode result;
551 bool udp_tunnel = TRNSPRT_IS_DGRAM(ctx->tunnel_transport);
553 if(cf->connected) {
554 *done = TRUE;
555 return CURLE_OK;
556 }
558 CURL_TRC_CF(data, cf, "CONNECT%s", udp_tunnel ? "-UDP" : "");
559connect_sub:
560 /* in case of h3_proxy, cf->next will be NULL initially */
561 if(cf->next) {
562 result = cf->next->cft->do_connect(cf->next, data, done);
563 if(result || !*done)
564 return result;
565 }
567 *done = FALSE;
568 if(!ctx->sub_filter_installed) {
569 const char *alpn = NULL;
571 /* in case of h3_proxy, cf->next will be NULL initially */
572 if(cf->next) {
573 alpn = Curl_conn_cf_get_alpn_negotiated(cf->next, data);
574 }
576 if(alpn)
577 infof(data, "CONNECT%s: '%s' negotiated",
578 udp_tunnel ? "-UDP" : "", alpn);
579 else if(!alpn) {
580 /* No ALPN, proxytype rules. Fake ALPN */
581 infof(data, "CONNECT%s: no ALPN negotiated", udp_tunnel ? "-UDP" : "");
582 switch(ctx->proxytype) {
583 case CURLPROXY_HTTP_1_0:
584 alpn = "http/1.0";
585 break;
586 case CURLPROXY_HTTPS2:
587 alpn = "h2";
588 break;
589 case CURLPROXY_HTTPS3:
590 alpn = "h3";
591 break;
592 default:
593 alpn = "http/1.1";
594 break;
595 }
596 }
598 if(!strcmp(alpn, "http/1.0")) {
599 CURL_TRC_CF(data, cf, "installing subfilter for HTTP/1.0");
600 result = Curl_cf_h1_proxy_insert_after(cf, data, ctx->peer,
601 ctx->tunnel_peer, 10, udp_tunnel);
602 if(result)
603 goto out;
604 }
605 else if(!strcmp(alpn, "http/1.1")) {
606 int httpversion = (ctx->proxytype == CURLPROXY_HTTP_1_0) ? 10 : 11;
607 CURL_TRC_CF(data, cf, "installing subfilter for HTTP/1.%d",
608 httpversion % 10);
609 result = Curl_cf_h1_proxy_insert_after(cf, data, ctx->peer,
610 ctx->tunnel_peer,
611 httpversion, udp_tunnel);
612 if(result)
613 goto out;
614 }
615#ifdef USE_NGHTTP2
616 else if(!strcmp(alpn, "h2")) {
617 CURL_TRC_CF(data, cf, "installing subfilter for HTTP/2");
618 result = Curl_cf_h2_proxy_insert_after(cf, data, ctx->peer,
619 ctx->tunnel_peer, udp_tunnel);
620 if(result)
621 goto out;
622 }
623#endif /* USE_NGHTTP2 */
624#if defined(USE_PROXY_HTTP3) && defined(USE_NGHTTP3) && \
625 defined(USE_NGTCP2) && defined(USE_OPENSSL)
626 else if(!strcmp(alpn, "h3")) {
627 CURL_TRC_CF(data, cf, "installing subfilter for HTTP/3");
628 result = Curl_cf_h3_proxy_insert_after(cf, data, ctx->peer, ctx->peer,
629 ctx->tunnel_peer,
630 ctx->tunnel_transport);
631 if(result)
632 goto out;
633 }
634#endif /* USE_PROXY_HTTP3 && USE_NGHTTP3 && USE_NGTCP2 && USE_OPENSSL */
635 else {
636 failf(data, "CONNECT%s: negotiated ALPN '%s' not supported",
637 udp_tunnel ? "-UDP" : "", alpn);
638 result = CURLE_COULDNT_CONNECT;
639 goto out;
640 }
642 ctx->sub_filter_installed = TRUE;
643 /* after we installed the filter "below" us, we call connect
644 * on out sub-chain again.
645 */
646 goto connect_sub;
647 }
648 else {
649 /* subchain connected and we had already installed the protocol filter.
650 * This means the protocol tunnel is established, we are done. */
651 DEBUGASSERT(ctx->sub_filter_installed);
652 result = CURLE_OK;
653 }
655out:
656 if(!result) {
657 cf->connected = TRUE;
658 *done = TRUE;
659 }
660 return result;
663static CURLcode cf_http_proxy_query(struct Curl_cfilter *cf,
664 struct Curl_easy *data,
665 int query, int *pres1, void *pres2)
667 struct cf_proxy_ctx *ctx = cf->ctx;
668 switch(query) {
669 case CF_QUERY_HOST_PORT:
670 *pres1 = (int)ctx->tunnel_peer->port;
671 *((const char **)pres2) = ctx->tunnel_peer->hostname;
672 return CURLE_OK;
673 case CF_QUERY_ALPN_NEGOTIATED: {
674 const char **palpn = pres2;
675 DEBUGASSERT(palpn);
676 *palpn = NULL;
677 return CURLE_OK;
678 }
679 default:
680 break;
681 }
682 return cf->next ?
683 cf->next->cft->query(cf->next, data, query, pres1, pres2) :
684 CURLE_UNKNOWN_OPTION;
687static void cf_https_proxy_ctx_free(struct cf_proxy_ctx *ctx)
689 if(ctx) {
690 Curl_peer_unlink(&ctx->peer);
691 Curl_peer_unlink(&ctx->tunnel_peer);
692 curlx_free(ctx);
693 }
696static void http_proxy_cf_destroy(struct Curl_cfilter *cf,
697 struct Curl_easy *data)
699 struct cf_proxy_ctx *ctx = cf->ctx;
700 if(ctx) {
701 CURL_TRC_CF(data, cf, "destroy");
702 cf_https_proxy_ctx_free(ctx);
703 }
706struct Curl_cftype Curl_cft_http_proxy = {
707 "HTTP-PROXY",
708 CF_TYPE_IP_CONNECT | CF_TYPE_PROXY | CF_TYPE_SETUP,
709 0,
710 http_proxy_cf_destroy,
711 http_proxy_cf_connect,
712 Curl_cf_def_shutdown,
713 Curl_cf_def_adjust_pollset,
714 Curl_cf_def_data_pending,
715 Curl_cf_def_send,
716 Curl_cf_def_recv,
717 Curl_cf_def_cntrl,
718 Curl_cf_def_conn_is_alive,
719 Curl_cf_def_conn_keep_alive,
720 cf_http_proxy_query,
721};
723CURLcode Curl_cf_http_proxy_insert_after(struct Curl_cfilter *cf_at,
724 struct Curl_easy *data,
725 struct Curl_peer *peer,
726 struct Curl_peer *tunnel_peer,
727 uint8_t tunnel_transport,
728 uint8_t proxytype)
730 struct Curl_cfilter *cf;
731 struct cf_proxy_ctx *ctx = NULL;
732 CURLcode result;
734 (void)data;
735 if(!peer || !tunnel_peer)
736 return CURLE_FAILED_INIT;
738 ctx = curlx_calloc(1, sizeof(*ctx));
739 if(!ctx) {
740 result = CURLE_OUT_OF_MEMORY;
741 goto out;
742 }
743 Curl_peer_link(&ctx->peer, peer);
744 Curl_peer_link(&ctx->tunnel_peer, tunnel_peer);
745 ctx->proxytype = proxytype;
746 ctx->tunnel_transport = tunnel_transport;
748 result = Curl_cf_create(&cf, &Curl_cft_http_proxy, ctx);
749 if(result)
750 goto out;
751 ctx = NULL;
752 Curl_conn_cf_insert_after(cf_at, cf);
754out:
755 cf_https_proxy_ctx_free(ctx);
756 return result;
759uint8_t Curl_http_proxy_transport(uint8_t proxytype)
761 switch(proxytype) {
762 case CURLPROXY_HTTPS3:
763 return TRNSPRT_QUIC;
764 default:
765 return TRNSPRT_TCP;
766 }
769#endif /* !CURL_DISABLE_HTTP && !CURL_DISABLE_PROXY */
Diagnostics4 git calls · 97 ms
CallStatusSizeTime097 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 · 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 · hit2 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=2
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
fetch2006.1 KiB · hit92 ms
git.upload-pack fetch
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=fetch
git.upstream.dur_ms=91
git.response.bytes=6278
git.response.cache=HIT
git.response.duration_ms=92
git.fetch.wants=ad79a477b74b8e458a2adde1d12039bb0c129101
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=6278
git.pkt.payload.max=6257
git.sideband.band1.bytes=6256
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
a5e1b1f68c5af54b
Request
9673e4c9…
Protocol
v2 · sha1
Agent
gitty/1.0
Filter
advertised
Fetch
shallow filter sideband-all
Capabilities
agent ls-refs fetch object-format