Artifactspublic-v0

curl

master
ply4 git calls60 ms289 KiB3 cachedprotocol v2
236 lines7.6 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#if defined(USE_HTTP3) && \
27 (defined(USE_OPENSSL) || defined(USE_GNUTLS) || defined(USE_WOLFSSL))
29#ifdef USE_OPENSSL
30#include <openssl/err.h>
31#include "vtls/openssl.h"
32#elif defined(USE_GNUTLS)
33#include <gnutls/abstract.h>
34#include <gnutls/gnutls.h>
35#include <gnutls/x509.h>
36#include <gnutls/crypto.h>
37#include <nettle/sha2.h>
38#include "vtls/gtls.h"
39#elif defined(USE_WOLFSSL)
40#include <wolfssl/options.h>
41#include <wolfssl/ssl.h>
42#include <wolfssl/quic.h>
43#include "vtls/wolfssl.h"
44#endif
46#include "urldata.h"
47#include "cfilters.h"
48#include "vtls/vtls.h"
49#include "vtls/vtls_scache.h"
50#include "vquic/vquic-tls.h"
52CURLcode Curl_vquic_tls_peer_init(struct Curl_peer *origin,
53 struct Curl_peer *peer,
54 struct ssl_filter_config *sslc,
55 struct ssl_peer *ssl_peer)
57 char tls_id[80];
59#ifdef USE_OPENSSL
60 Curl_ossl_version(tls_id, sizeof(tls_id));
61#elif defined(USE_GNUTLS)
62 Curl_gtls_version(tls_id, sizeof(tls_id));
63#elif defined(USE_WOLFSSL)
64 Curl_wssl_version(tls_id, sizeof(tls_id));
65#else
66#error "no TLS lib in used, should not happen"
67 return CURLE_FAILED_INIT;
68#endif
69 if(ssl_peer->origin || ssl_peer->peer)
70 Curl_ssl_peer_cleanup(ssl_peer);
71 return Curl_ssl_peer_init(ssl_peer, origin, peer, sslc,
72 tls_id, TRNSPRT_QUIC);
75CURLcode Curl_vquic_tls_init(struct curl_tls_ctx *ctx,
76 struct Curl_cfilter *cf,
77 struct Curl_easy *data,
78 struct ssl_peer *ssl_peer,
79 const struct alpn_spec *alpns,
80 Curl_vquic_tls_ctx_setup *cb_setup,
81 void *cb_user_data, void *ssl_user_data,
82 Curl_vquic_session_reuse_cb *session_reuse_cb)
84#ifdef USE_OPENSSL
85 return Curl_ossl_ctx_init(&ctx->ossl, cf, data, ssl_peer, alpns,
86 cb_setup, cb_user_data, NULL, ssl_user_data,
87 session_reuse_cb);
88#elif defined(USE_GNUTLS)
89 return Curl_gtls_ctx_init(&ctx->gtls, cf, data, ssl_peer, alpns,
90 cb_setup, cb_user_data, ssl_user_data,
91 session_reuse_cb);
92#elif defined(USE_WOLFSSL)
93 return Curl_wssl_ctx_init(&ctx->wssl, cf, data, ssl_peer, alpns,
94 cb_setup, cb_user_data,
95 ssl_user_data, session_reuse_cb);
96#else
97#error "no TLS lib in used, should not happen"
98 return CURLE_FAILED_INIT;
99#endif
102void Curl_vquic_tls_cleanup(struct curl_tls_ctx *ctx)
104#ifdef USE_OPENSSL
105 Curl_osslctx_cleanup(&ctx->ossl);
106#elif defined(USE_GNUTLS)
107 if(ctx->gtls.session)
108 gnutls_deinit(ctx->gtls.session);
109 Curl_gtls_shared_creds_free(&ctx->gtls.shared_creds);
110#elif defined(USE_WOLFSSL)
111 if(ctx->wssl.ssl)
112 wolfSSL_free(ctx->wssl.ssl);
113 if(ctx->wssl.ssl_ctx)
114 wolfSSL_CTX_free(ctx->wssl.ssl_ctx);
115#endif
116 memset(ctx, 0, sizeof(*ctx));
119CURLcode Curl_vquic_tls_before_recv(struct curl_tls_ctx *ctx,
120 struct Curl_cfilter *cf,
121 struct Curl_easy *data)
123#ifdef USE_OPENSSL
124 if(!ctx->ossl.x509_store_setup) {
125 CURLcode result = Curl_ssl_setup_x509_store(cf, data, &ctx->ossl);
126 if(result)
127 return result;
128 ctx->ossl.x509_store_setup = TRUE;
129 }
130#elif defined(USE_WOLFSSL)
131 if(!ctx->wssl.x509_store_setup) {
132 CURLcode result = Curl_wssl_setup_x509_store(cf, data, &ctx->wssl);
133 if(result)
134 return result;
135 }
136#elif defined(USE_GNUTLS)
137 if(!ctx->gtls.shared_creds->trust_setup) {
138 CURLcode result = Curl_gtls_client_trust_setup(cf, data, &ctx->gtls);
139 if(result)
140 return result;
141 }
142#else
143 (void)ctx;
144 (void)cf;
145 (void)data;
146#endif
147 return CURLE_OK;
150CURLcode Curl_vquic_tls_verify_peer(struct curl_tls_ctx *ctx,
151 struct Curl_cfilter *cf,
152 struct Curl_easy *data,
153 struct ssl_peer *peer)
155 struct ssl_filter_config *conn_config;
156 CURLcode result = CURLE_OK;
158 conn_config = Curl_ssl_cf_get_filter_config(cf);
159 if(!conn_config)
160 return CURLE_FAILED_INIT;
162#ifdef USE_OPENSSL
163 (void)conn_config;
164 result = Curl_ossl_check_peer_cert(cf, data, &ctx->ossl, peer);
165#elif defined(USE_GNUTLS)
166 result = Curl_gtls_verifyserver(
167 cf, data, ctx->gtls.session, conn_config, &data->set.ssl, peer,
168 CURL_EASY_STR(data, STRING_SSL_PINNEDPUBLICKEY));
169#elif defined(USE_WOLFSSL)
170 (void)data;
171 if(conn_config->verifyhost) {
172 WOLFSSL_X509 *cert = wolfSSL_get_peer_certificate(ctx->wssl.ssl);
173 if(!cert)
174 result = CURLE_OUT_OF_MEMORY;
175 else if(peer->sni &&
176 (wolfSSL_X509_check_host(cert, peer->sni, strlen(peer->sni), 0,
177 NULL) == WOLFSSL_FAILURE))
178 result = CURLE_PEER_FAILED_VERIFICATION;
179 else if(!peer->sni &&
180 (wolfSSL_X509_check_ip_asc(cert, peer->origin->hostname,
181 0) == WOLFSSL_FAILURE))
182 result = CURLE_PEER_FAILED_VERIFICATION;
183 wolfSSL_X509_free(cert);
184 }
185 if(!result)
186 result = Curl_wssl_verify_pinned(cf, data, &ctx->wssl);
187#endif
188 /* on error, remove any session we might have in the pool */
189 if(result)
190 Curl_ssl_scache_remove_all(cf, data, peer->scache_key);
191 return result;
194bool Curl_vquic_tls_get_ssl_info(struct curl_tls_ctx *ctx,
195 bool give_ssl_ctx,
196 struct curl_tlssessioninfo *info)
198#ifdef USE_OPENSSL
199 info->backend = CURLSSLBACKEND_OPENSSL;
200 info->internals = give_ssl_ctx ?
201 (void *)ctx->ossl.ssl_ctx : (void *)ctx->ossl.ssl;
202 return TRUE;
203#elif defined(USE_GNUTLS)
204 (void)give_ssl_ctx; /* gnutls always returns its session */
205 info->backend = CURLSSLBACKEND_GNUTLS;
206 info->internals = ctx->gtls.session;
207 return TRUE;
208#elif defined(USE_WOLFSSL)
209 info->backend = CURLSSLBACKEND_WOLFSSL;
210 info->internals = give_ssl_ctx ?
211 (void *)ctx->wssl.ssl_ctx : (void *)ctx->wssl.ssl;
212 return TRUE;
213#else
214 return FALSE;
215#endif
218void Curl_vquic_report_handshake(struct curl_tls_ctx *ctx,
219 struct Curl_cfilter *cf,
220 struct Curl_easy *data)
222 (void)cf;
223#ifdef USE_OPENSSL
224 (void)cf;
225 Curl_ossl_report_handshake(data, &ctx->ossl);
226#elif defined(USE_GNUTLS)
227 Curl_gtls_report_handshake(data, &ctx->gtls);
228#elif defined(USE_WOLFSSL)
229 Curl_wssl_report_handshake(data, &ctx->wssl);
230#else
231 (void)data;
232 (void)ctx;
233#endif
236#endif /* !USE_HTTP3 && (USE_OPENSSL || USE_GNUTLS || USE_WOLFSSL) */
Diagnostics4 git calls · 60 ms
CallStatusSizeTime060 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=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 · hit2 ms
git.upload-pack fetch
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=fetch
git.upstream.dur_ms=55
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
fetch2002.3 KiB · hit55 ms
git.upload-pack fetch
http.response.status_code=200
git.response.bytes=2309
git.response.cache=HIT
git.response.duration_ms=55
git.fetch.wants=dbf83963bcf71beb60c3b96fff1f10264b5cb639
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=2309
git.pkt.payload.max=2288
git.sideband.band1.bytes=2287
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
a5e368e8dfbc724e
Request
4a070168…
Protocol
v2 · sha1
Agent
gitty/1.0
Filter
advertised
Fetch
shallow filter sideband-all
Capabilities
agent ls-refs fetch object-format