Artifactspublic-v0

curl

master
ply4 git calls14 ms288 KiB3 cachedprotocol v2
157 lines4.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 "curl_setup.h"
26#ifndef CURL_DISABLE_WEBSOCKETS
27/* only used for this protocol, so far */
29#include "urldata.h"
30#include "bufq.h"
31#include "cfilters.h"
32#include "cf-recvbuf.h"
33#include "curl_trc.h"
35#define CURL_CF_RECVBUF_CHUNK (16 * 1024)
37struct cf_recvbuf_ctx {
38 struct bufq recvbuf;
39};
41static void cf_recvbuf_destroy(struct Curl_cfilter *cf,
42 struct Curl_easy *data)
44 struct cf_recvbuf_ctx *ctx = cf->ctx;
45 (void)data;
46 if(ctx) {
47 Curl_bufq_free(&ctx->recvbuf);
48 curlx_free(ctx);
49 }
52static CURLcode cf_recvbuf_recv(struct Curl_cfilter *cf,
53 struct Curl_easy *data,
54 char *buf, size_t len,
55 size_t *pnread)
57 struct cf_recvbuf_ctx *ctx = cf->ctx;
59 if(!Curl_bufq_is_empty(&ctx->recvbuf)) {
60 return Curl_bufq_cread(&ctx->recvbuf, buf, len, pnread);
61 }
63 if(cf->next)
64 return cf->next->cft->do_recv(cf->next, data, buf, len, pnread);
65 *pnread = 0;
66 return CURLE_RECV_ERROR;
69static bool cf_recvbuf_data_pending(struct Curl_cfilter *cf,
70 const struct Curl_easy *data)
72 struct cf_recvbuf_ctx *ctx = cf->ctx;
74 if(!Curl_bufq_is_empty(&ctx->recvbuf))
75 return TRUE;
77 return cf->next ?
78 cf->next->cft->has_data_pending(cf->next, data) : FALSE;
81struct Curl_cftype Curl_cft_recvbuf = {
82 "RECVBUF",
83 0,
84 CURL_LOG_LVL_NONE,
85 cf_recvbuf_destroy,
86 Curl_cf_def_connect,
87 Curl_cf_def_shutdown,
88 Curl_cf_def_adjust_pollset,
89 cf_recvbuf_data_pending,
90 Curl_cf_def_send,
91 cf_recvbuf_recv,
92 Curl_cf_def_cntrl,
93 Curl_cf_def_conn_is_alive,
94 Curl_cf_def_conn_keep_alive,
95 Curl_cf_def_query,
96};
98static CURLcode cf_recvbuf_create(struct Curl_cfilter **pcf,
99 struct Curl_easy *data,
100 const uint8_t *buf, size_t blen)
102 struct Curl_cfilter *cf = NULL;
103 struct cf_recvbuf_ctx *ctx;
104 CURLcode result = CURLE_OK;
105 size_t nwritten = 0;
107 (void)data;
108 ctx = curlx_calloc(1, sizeof(*ctx));
109 if(!ctx) {
110 result = CURLE_OUT_OF_MEMORY;
111 goto out;
112 }
113 Curl_bufq_init2(&ctx->recvbuf, CURL_CF_RECVBUF_CHUNK,
114 (blen / CURL_CF_RECVBUF_CHUNK) + 1,
115 (BUFQ_OPT_SOFT_LIMIT | BUFQ_OPT_NO_SPARES));
116 result = Curl_bufq_write(&ctx->recvbuf, buf, blen, &nwritten);
117 if(result)
118 goto out;
119 if(nwritten != blen) {
120 result = CURLE_FAILED_INIT;
121 goto out;
122 }
124 result = Curl_cf_create(&cf, &Curl_cft_recvbuf, ctx);
125 if(result)
126 goto out;
127 ctx = NULL;
129out:
130 *pcf = result ? NULL : cf;
131 if(ctx) {
132 Curl_bufq_free(&ctx->recvbuf);
133 curlx_free(ctx);
134 }
135 return result;
138CURLcode Curl_cf_recvbuf_add(struct Curl_easy *data,
139 struct connectdata *conn,
140 int8_t sockindex,
141 const uint8_t *buf, size_t blen)
143 struct Curl_cfilter *cf;
144 CURLcode result = CURLE_OK;
146 DEBUGASSERT(data);
147 result = cf_recvbuf_create(&cf, data, buf, blen);
148 if(result)
149 goto out;
151 cf->connected = Curl_conn_is_connected(conn, sockindex);
152 Curl_conn_cf_add(data, conn, sockindex, cf);
153out:
154 return result;
157#endif /* !CURL_DISABLE_WEBSOCKETS */
Diagnostics4 git calls · 14 ms
CallStatusSizeTime014 ms
discover200152 B6 ms
git.upload-pack discover
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=fetch
git.upstream.dur_ms=3
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 · hit4 ms
git.upload-pack ls-refs
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=ls-refs
git.upstream.dur_ms=4
git.response.bytes=149
git.response.cache=HIT
git.response.duration_ms=4
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 · hit4 ms
git.upload-pack fetch
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=fetch
git.upstream.dur_ms=4
git.response.bytes=293470
git.response.cache=HIT
git.response.duration_ms=4
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
fetch2001.5 KiB · hit4 ms
git.upload-pack fetch
http.response.status_code=200
git.response.bytes=1498
git.response.cache=HIT
git.response.duration_ms=4
git.fetch.wants=55b01a26f5c8e26b690465a9b0b1cac5b95ab500
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=1498
git.pkt.payload.max=1477
git.sideband.band1.bytes=1476
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
a5e2daa73c94c125
Request
146a0e99…
Protocol
v2 · sha1
Agent
gitty/1.0
Filter
advertised
Fetch
shallow filter sideband-all
Capabilities
agent ls-refs fetch object-format