master
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_HTTP
28#include "urldata.h" /* it includes http_chunks.h */
29#include "curl_trc.h"
30#include "http.h" /* for Curl_verify_header */
31#include "sendf.h" /* for the client write stuff */
32#include "curlx/dynbuf.h"
33#include "multiif.h"
34#include "curlx/strparse.h"
36/*
37 Chunk format (simplified):
39 <HEX SIZE>[ chunk extension ] CRLF
40 <DATA> CRLF
42 Highlights from RFC2616 section 3.6 say:
44 The chunked encoding modifies the body of a message in order to
45 transfer it as a series of chunks, each with its own size indicator,
46 followed by an OPTIONAL trailer containing entity-header fields. This
47 allows dynamically produced content to be transferred along with the
48 information necessary for the recipient to verify that it has
49 received the full message.
51 Chunked-Body = *chunk
52 last-chunk
53 trailer
54 CRLF
56 chunk = chunk-size [ chunk-extension ] CRLF
57 chunk-data CRLF
58 chunk-size = 1*HEX
59 last-chunk = 1*("0") [ chunk-extension ] CRLF
61 chunk-extension= *( ";" chunk-ext-name [ "=" chunk-ext-val ] )
62 chunk-ext-name = token
63 chunk-ext-val = token | quoted-string
64 chunk-data = chunk-size(OCTET)
65 trailer = *(entity-header CRLF)
67 The chunk-size field is a string of hex digits indicating the size of
68 the chunk. The chunked encoding is ended by any chunk whose size is
69 zero, followed by the trailer, which is terminated by an empty line.
71 */
73void Curl_httpchunk_init(struct Curl_easy *data, struct Curl_chunker *ch,
74 bool ignore_body, bool in_connect)
75{
76 (void)data;
77 ch->hexindex = 0; /* start at 0 */
78 ch->state = CHUNK_HEX; /* we get hex first! */
79 ch->last_code = CHUNKE_OK;
80 curlx_dyn_init(&ch->trailer, DYN_H1_TRAILER);
81 ch->ignore_body = ignore_body;
82 ch->in_connect = in_connect;
83}
85void Curl_httpchunk_reset(struct Curl_easy *data, struct Curl_chunker *ch,
86 bool ignore_body)
87{
88 (void)data;
89 ch->hexindex = 0; /* start at 0 */
90 ch->state = CHUNK_HEX; /* we get hex first! */
91 ch->last_code = CHUNKE_OK;
92 curlx_dyn_reset(&ch->trailer);
93 ch->ignore_body = ignore_body;
94}
96void Curl_httpchunk_free(struct Curl_easy *data, struct Curl_chunker *ch)
97{
98 (void)data;
99 curlx_dyn_free(&ch->trailer);
100}
102bool Curl_httpchunk_is_done(struct Curl_easy *data, struct Curl_chunker *ch)
103{
104 (void)data;
105 return ch->state == CHUNK_DONE;
106}
108static CURLcode httpchunk_readwrite(struct Curl_easy *data,
109 struct Curl_chunker *ch,
110 struct Curl_cwriter *cw_next,
111 const char *buf, size_t blen,
112 size_t *pconsumed)
113{
114 CURLcode result = CURLE_OK;
115 size_t piece;
117 *pconsumed = 0; /* nothing's written yet */
118 /* first check terminal states that will not progress anywhere */
119 if(ch->state == CHUNK_DONE)
120 return CURLE_OK;
121 if(ch->state == CHUNK_FAILED)
122 return CURLE_RECV_ERROR;
124 /* the original data is written to the client, but we go on with the
125 chunk read process, to properly calculate the content length */
126 if(data->set.http_te_skip && !ch->ignore_body) {
127 if(cw_next)
128 result = Curl_cwriter_write(data, cw_next, CLIENTWRITE_BODY, buf, blen);
129 else
130 result = Curl_client_write(data, CLIENTWRITE_BODY, buf, blen);
131 if(result) {
132 ch->state = CHUNK_FAILED;
133 ch->last_code = CHUNKE_PASSTHRU_ERROR;
134 return result;
135 }
136 }
138 while(blen) {
139 switch(ch->state) {
140 case CHUNK_HEX:
141 if(ISXDIGIT(*buf)) {
142 if(ch->hexindex >= CHUNK_MAXNUM_LEN) {
143 failf(data, "chunk hex-length longer than %d", CHUNK_MAXNUM_LEN);
144 ch->state = CHUNK_FAILED;
145 ch->last_code = CHUNKE_TOO_LONG_HEX; /* longer than we support */
146 return CURLE_RECV_ERROR;
147 }
148 ch->hexbuffer[ch->hexindex++] = *buf;
149 buf++;
150 blen--;
151 (*pconsumed)++;
152 }
153 else {
154 const char *p;
155 if(ch->hexindex == 0) {
156 /* This is illegal data, we received junk where we expected
157 a hexadecimal digit. */
158 failf(data, "chunk hex-length char not a hex digit: 0x%x",
159 (unsigned int)*buf);
160 ch->state = CHUNK_FAILED;
161 ch->last_code = CHUNKE_ILLEGAL_HEX;
162 return CURLE_RECV_ERROR;
163 }
164 /* blen and buf are unmodified */
165 ch->hexbuffer[ch->hexindex] = 0;
166 p = &ch->hexbuffer[0];
167 if(curlx_str_hex(&p, &ch->datasize, CURL_OFF_T_MAX)) {
168 failf(data, "invalid chunk size: '%s'", ch->hexbuffer);
169 ch->state = CHUNK_FAILED;
170 ch->last_code = CHUNKE_ILLEGAL_HEX;
171 return CURLE_RECV_ERROR;
172 }
173 ch->state = CHUNK_LF; /* now wait for the CRLF */
174 }
175 break;
177 case CHUNK_LF:
178 /* waiting for the LF after a chunk size */
179 if(*buf == 0x0a) {
180 /* we are now expecting data to come, unless size was zero! */
181 if(ch->datasize == 0) {
182 ch->state = CHUNK_TRAILER; /* now check for trailers */
183 }
184 else {
185 ch->state = CHUNK_DATA;
186 CURL_TRC_WRITE(data, "http_chunked, chunk start of %"
187 FMT_OFF_T " bytes", ch->datasize);
188 }
189 }
191 buf++;
192 blen--;
193 (*pconsumed)++;
194 break;
196 case CHUNK_DATA:
197 /* We expect 'datasize' of data. We have 'blen' right now, it can be
198 more or less than 'datasize'. Get the smallest piece. */
199 piece = blen;
200 if(ch->datasize < (curl_off_t)blen)
201 piece = curlx_sotouz(ch->datasize);
203 /* Write the data portion available */
204 if(!data->set.http_te_skip && !ch->ignore_body) {
205 if(cw_next)
206 result = Curl_cwriter_write(data, cw_next, CLIENTWRITE_BODY,
207 buf, piece);
208 else
209 result = Curl_client_write(data, CLIENTWRITE_BODY, buf, piece);
210 if(result) {
211 ch->state = CHUNK_FAILED;
212 ch->last_code = CHUNKE_PASSTHRU_ERROR;
213 return result;
214 }
215 }
217 *pconsumed += piece;
218 ch->datasize -= piece; /* decrease amount left to expect */
219 buf += piece; /* move read pointer forward */
220 blen -= piece; /* decrease space left in this round */
221 CURL_TRC_WRITE(data, "http_chunked, write %zu body bytes, %"
222 FMT_OFF_T " bytes in chunk remain",
223 piece, ch->datasize);
225 if(ch->datasize == 0)
226 /* end of data this round, we now expect a trailing CRLF */
227 ch->state = CHUNK_POSTLF;
228 break;
230 case CHUNK_POSTLF:
231 if(*buf == 0x0a) {
232 /* The last one before we go back to hex state and start all over. */
233 Curl_httpchunk_reset(data, ch, (bool)ch->ignore_body);
234 }
235 else if(*buf != 0x0d) {
236 ch->state = CHUNK_FAILED;
237 ch->last_code = CHUNKE_BAD_CHUNK;
238 return CURLE_RECV_ERROR;
239 }
240 buf++;
241 blen--;
242 (*pconsumed)++;
243 break;
245 case CHUNK_TRAILER:
246 if((*buf == 0x0d) || (*buf == 0x0a)) {
247 const char *tr = curlx_dyn_ptr(&ch->trailer);
248 /* this is the end of a trailer, but if the trailer was zero bytes
249 there was no trailer and we move on */
251 if(tr) {
252 size_t trlen;
253 result = curlx_dyn_addn(&ch->trailer, STRCONST("\x0d\x0a"));
254 if(result) {
255 ch->state = CHUNK_FAILED;
256 ch->last_code = CHUNKE_OUT_OF_MEMORY;
257 return result;
258 }
259 tr = curlx_dyn_ptr(&ch->trailer);
260 trlen = curlx_dyn_len(&ch->trailer);
262 /* a trailer is delivered to the client as a header, so it must pass
263 the same checks as a regular response header */
264 result = Curl_verify_header(data, tr, trlen);
265 if(result) {
266 ch->state = CHUNK_FAILED;
267 ch->last_code = CHUNKE_BAD_CHUNK;
268 return result;
269 }
271 if(!data->set.http_te_skip) {
272 int hd_type = CLIENTWRITE_HEADER | CLIENTWRITE_TRAILER;
273 if(ch->in_connect)
274 hd_type |= CLIENTWRITE_CONNECT;
275 if(cw_next)
276 result = Curl_cwriter_write(data, cw_next, hd_type, tr, trlen);
277 else
278 result = Curl_client_write(data, hd_type, tr, trlen);
279 CURL_TRC_WRITE(data, "wrote trailer '%s'", tr);
280 if(result) {
281 ch->state = CHUNK_FAILED;
282 ch->last_code = CHUNKE_PASSTHRU_ERROR;
283 return result;
284 }
285 result = Curl_bump_headersize(data, trlen, FALSE);
286 if(result) {
287 ch->state = CHUNK_FAILED;
288 ch->last_code = CHUNKE_TRAILER_LIMIT;
289 return result;
290 }
291 }
292 curlx_dyn_reset(&ch->trailer);
293 ch->state = CHUNK_TRAILER_CR;
294 if(*buf == 0x0a)
295 /* already on the LF */
296 break;
297 }
298 else {
299 /* no trailer, we are on the final CRLF pair */
300 ch->state = CHUNK_TRAILER_POSTCR;
301 break; /* do not advance the pointer */
302 }
303 }
304 else {
305 result = curlx_dyn_addn(&ch->trailer, buf, 1);
306 if(result) {
307 ch->state = CHUNK_FAILED;
308 ch->last_code = CHUNKE_OUT_OF_MEMORY;
309 return result;
310 }
311 }
312 buf++;
313 blen--;
314 (*pconsumed)++;
315 break;
317 case CHUNK_TRAILER_CR:
318 if(*buf == 0x0a) {
319 ch->state = CHUNK_TRAILER_POSTCR;
320 buf++;
321 blen--;
322 (*pconsumed)++;
323 }
324 else {
325 ch->state = CHUNK_FAILED;
326 ch->last_code = CHUNKE_BAD_CHUNK;
327 return CURLE_RECV_ERROR;
328 }
329 break;
331 case CHUNK_TRAILER_POSTCR:
332 /* We enter this state when a CR should arrive so we expect to
333 have to first pass a CR before we wait for LF */
334 if((*buf != 0x0d) && (*buf != 0x0a)) {
335 /* not a CR then it must be another header in the trailer */
336 ch->state = CHUNK_TRAILER;
337 break;
338 }
339 if(*buf == 0x0d) {
340 /* skip if CR */
341 buf++;
342 blen--;
343 (*pconsumed)++;
344 }
345 /* now wait for the final LF */
346 ch->state = CHUNK_STOP;
347 break;
349 case CHUNK_STOP:
350 if(*buf == 0x0a) {
351 blen--;
352 (*pconsumed)++;
353 /* Record the length of any data left in the end of the buffer
354 even if there is no more chunks to read */
355 ch->datasize = blen;
356 ch->state = CHUNK_DONE;
357 CURL_TRC_WRITE(data, "http_chunk, response complete");
358 return CURLE_OK;
359 }
360 else {
361 ch->state = CHUNK_FAILED;
362 ch->last_code = CHUNKE_BAD_CHUNK;
363 CURL_TRC_WRITE(data, "http_chunk error, expected 0x0a, seeing 0x%ux",
364 (unsigned int)*buf);
365 return CURLE_RECV_ERROR;
366 }
367 case CHUNK_DONE:
368 return CURLE_OK;
370 case CHUNK_FAILED:
371 return CURLE_RECV_ERROR;
372 }
373 }
374 return CURLE_OK;
375}
377static const char *Curl_chunked_strerror(CHUNKcode code)
378{
379 switch(code) {
380 default:
381 return "OK";
382 case CHUNKE_TOO_LONG_HEX:
383 return "Too long hexadecimal number";
384 case CHUNKE_ILLEGAL_HEX:
385 return "Illegal or missing hexadecimal sequence";
386 case CHUNKE_BAD_CHUNK:
387 return "Malformed encoding found";
388 case CHUNKE_PASSTHRU_ERROR:
389 return "Error writing data to client";
390 case CHUNKE_BAD_ENCODING:
391 return "Bad content-encoding found";
392 case CHUNKE_OUT_OF_MEMORY:
393 return "Out of memory";
394 case CHUNKE_TRAILER_LIMIT:
395 return "trailers exceeded header limit";
396 }
397}
399CURLcode Curl_httpchunk_read(struct Curl_easy *data,
400 struct Curl_chunker *ch,
401 char *buf, size_t blen,
402 size_t *pconsumed)
403{
404 return httpchunk_readwrite(data, ch, NULL, buf, blen, pconsumed);
405}
407struct chunked_writer {
408 struct Curl_cwriter super;
409 struct Curl_chunker ch;
410};
412static CURLcode cw_chunked_init(struct Curl_easy *data,
413 struct Curl_cwriter *writer)
414{
415 struct chunked_writer *ctx = writer->ctx;
417 data->req.chunk = TRUE; /* chunks coming our way. */
418 Curl_httpchunk_init(data, &ctx->ch, FALSE, FALSE);
419 return CURLE_OK;
420}
422static void cw_chunked_close(struct Curl_easy *data,
423 struct Curl_cwriter *writer)
424{
425 struct chunked_writer *ctx = writer->ctx;
426 Curl_httpchunk_free(data, &ctx->ch);
427}
429static CURLcode cw_chunked_write(struct Curl_easy *data,
430 struct Curl_cwriter *writer, int type,
431 const char *buf, size_t blen)
432{
433 struct chunked_writer *ctx = writer->ctx;
434 CURLcode result;
435 size_t consumed;
437 if(!(type & CLIENTWRITE_BODY))
438 return Curl_cwriter_write(data, writer->next, type, buf, blen);
440 consumed = 0;
441 result = httpchunk_readwrite(data, &ctx->ch, writer->next, buf, blen,
442 &consumed);
444 if(result) {
445 if(CHUNKE_PASSTHRU_ERROR == ctx->ch.last_code) {
446 failf(data, "Failed reading the chunked-encoded stream");
447 }
448 else {
449 failf(data, "%s in chunked-encoding",
450 Curl_chunked_strerror(ctx->ch.last_code));
451 }
452 return result;
453 }
455 blen -= consumed;
456 if(CHUNK_DONE == ctx->ch.state) {
457 /* chunks read successfully, download is complete */
458 data->req.download_done = TRUE;
459 if(blen) {
460 infof(data, "Leftovers after chunking: %zu bytes", blen);
461 }
462 }
463 else if((type & CLIENTWRITE_EOS) && !data->req.no_body) {
464 failf(data, "transfer closed with outstanding read data remaining");
465 return CURLE_PARTIAL_FILE;
466 }
468 return CURLE_OK;
469}
471/* HTTP chunked Transfer-Encoding decoder */
472const struct Curl_cwtype Curl_httpchunk_unencoder = {
473 "chunked",
474 NULL,
475 0,
476 cw_chunked_init,
477 cw_chunked_write,
478 Curl_cwriter_def_flush,
479 cw_chunked_close,
480 sizeof(struct chunked_writer)
481};
483/* max length of an HTTP chunk that we want to generate */
484#define CURL_CHUNKED_MINLEN 1024
485#define CURL_CHUNKED_MAXLEN (64 * 1024)
487struct chunked_reader {
488 struct Curl_creader super;
489 struct bufq chunkbuf;
490 BIT(read_eos); /* we read an EOS from the next reader */
491 BIT(eos); /* we have returned an EOS */
492};
494static CURLcode cr_chunked_init(struct Curl_easy *data,
495 struct Curl_creader *reader)
496{
497 struct chunked_reader *ctx = reader->ctx;
498 (void)data;
499 Curl_bufq_init2(&ctx->chunkbuf, CURL_CHUNKED_MAXLEN, 2, BUFQ_OPT_SOFT_LIMIT);
500 return CURLE_OK;
501}
503static void cr_chunked_close(struct Curl_easy *data,
504 struct Curl_creader *reader)
505{
506 struct chunked_reader *ctx = reader->ctx;
507 (void)data;
508 Curl_bufq_free(&ctx->chunkbuf);
509}
511static CURLcode add_last_chunk(struct Curl_easy *data,
512 struct Curl_creader *reader)
513{
514 struct chunked_reader *ctx = reader->ctx;
515 struct curl_slist *trailers = NULL, *tr;
516 CURLcode result;
517 size_t n;
518 int rc;
520 if(!data->set.trailer_callback) {
521 CURL_TRC_READ(data, "http_chunk, added last, empty chunk");
522 return Curl_bufq_cwrite(&ctx->chunkbuf, STRCONST("0\r\n\r\n"), &n);
523 }
525 result = Curl_bufq_cwrite(&ctx->chunkbuf, STRCONST("0\r\n"), &n);
526 if(result)
527 goto out;
529 {
530 struct Curl_mapi_guard guard;
531 CURL_CBAPI_START(&guard, data, easy_trailer_callback);
532 rc = data->set.trailer_callback(&trailers, data->set.trailer_data);
533 CURL_CBAPI_END(&guard);
534 }
536 if(rc != CURL_TRAILERFUNC_OK) {
537 failf(data, "operation aborted by trailing headers callback");
538 result = CURLE_ABORTED_BY_CALLBACK;
539 goto out;
540 }
542 for(tr = trailers; tr; tr = tr->next) {
543 /* only add correctly formatted trailers */
544 const char *ptr = strchr(tr->data, ':');
545 if(!ptr || *(ptr + 1) != ' ') {
546 infof(data, "Malformatted trailing header, skipping trailer");
547 continue;
548 }
550 result = Curl_bufq_cwrite(&ctx->chunkbuf, tr->data, strlen(tr->data), &n);
551 if(!result)
552 result = Curl_bufq_cwrite(&ctx->chunkbuf, STRCONST("\r\n"), &n);
553 if(result)
554 goto out;
555 }
557 result = Curl_bufq_cwrite(&ctx->chunkbuf, STRCONST("\r\n"), &n);
559out:
560 curl_slist_free_all(trailers);
561 CURL_TRC_READ(data, "http_chunk, added last chunk with trailers "
562 "from client -> %d", (int)result);
563 return result;
564}
566static CURLcode add_chunk(struct Curl_easy *data,
567 struct Curl_creader *reader,
568 char *buf, size_t blen)
569{
570 struct chunked_reader *ctx = reader->ctx;
571 CURLcode result;
572 char tmp[CURL_CHUNKED_MINLEN];
573 size_t nread;
574 bool eos;
576 DEBUGASSERT(!ctx->read_eos);
577 blen = CURLMIN(blen, CURL_CHUNKED_MAXLEN); /* respect our buffer pref */
578 if(blen < sizeof(tmp)) {
579 /* small read, make a chunk of decent size */
580 buf = tmp;
581 blen = sizeof(tmp);
582 }
583 else {
584 /* larger read, make a chunk that will fit when read back */
585 blen -= (8 + 2 + 2); /* deduct max overhead, 8 hex + 2*crlf */
586 }
588 result = Curl_creader_read(data, reader->next, buf, blen, &nread, &eos);
589 if(result)
590 return result;
591 if(eos)
592 ctx->read_eos = TRUE;
594 if(nread) {
595 /* actually got bytes, wrap them into the chunkbuf */
596 char hd[11] = "";
597 int hdlen;
598 size_t n;
600 hdlen = curl_msnprintf(hd, sizeof(hd), "%zx\r\n", nread);
601 if(hdlen <= 0)
602 return CURLE_READ_ERROR;
603 /* On a soft-limited bufq, we do not need to check that all was written */
604 result = Curl_bufq_cwrite(&ctx->chunkbuf, hd, hdlen, &n);
605 if(!result)
606 result = Curl_bufq_cwrite(&ctx->chunkbuf, buf, nread, &n);
607 if(!result)
608 result = Curl_bufq_cwrite(&ctx->chunkbuf, "\r\n", 2, &n);
609 CURL_TRC_READ(data, "http_chunk, made chunk of %zu bytes -> %d",
610 nread, (int)result);
611 if(result)
612 return result;
613 }
615 if(ctx->read_eos)
616 return add_last_chunk(data, reader);
617 return CURLE_OK;
618}
620static CURLcode cr_chunked_read(struct Curl_easy *data,
621 struct Curl_creader *reader,
622 char *buf, size_t blen,
623 size_t *pnread, bool *peos)
624{
625 struct chunked_reader *ctx = reader->ctx;
626 CURLcode result = CURLE_READ_ERROR;
628 *pnread = 0;
629 *peos = (bool)ctx->eos;
631 if(!ctx->eos) {
632 if(!ctx->read_eos && Curl_bufq_is_empty(&ctx->chunkbuf)) {
633 /* Still getting data form the next reader, buffer is empty */
634 result = add_chunk(data, reader, buf, blen);
635 if(result)
636 return result;
637 }
639 if(!Curl_bufq_is_empty(&ctx->chunkbuf)) {
640 result = Curl_bufq_cread(&ctx->chunkbuf, buf, blen, pnread);
641 if(!result && ctx->read_eos && Curl_bufq_is_empty(&ctx->chunkbuf)) {
642 /* no more data, read all, done. */
643 ctx->eos = TRUE;
644 *peos = TRUE;
645 }
646 return result;
647 }
648 }
649 /* We may get here, because we are done or because callbacks paused */
650 DEBUGASSERT(ctx->eos || !ctx->read_eos);
651 return CURLE_OK;
652}
654static curl_off_t cr_chunked_total_length(struct Curl_easy *data,
655 struct Curl_creader *reader)
656{
657 /* this reader changes length depending on input */
658 (void)data;
659 (void)reader;
660 return -1;
661}
663/* HTTP chunked Transfer-Encoding encoder */
664const struct Curl_crtype Curl_httpchunk_encoder = {
665 "chunked",
666 cr_chunked_init,
667 cr_chunked_read,
668 cr_chunked_close,
669 Curl_creader_def_needs_rewind,
670 cr_chunked_total_length,
671 Curl_creader_def_resume_from,
672 Curl_creader_def_cntrl,
673 Curl_creader_def_is_paused,
674 Curl_creader_def_done,
675 sizeof(struct chunked_reader)
676};
678CURLcode Curl_httpchunk_add_reader(struct Curl_easy *data)
679{
680 struct Curl_creader *reader = NULL;
681 CURLcode result;
683 result = Curl_creader_create(&reader, data, &Curl_httpchunk_encoder,
684 CURL_CR_TRANSFER_ENCODE);
685 if(!result)
686 result = Curl_creader_add(data, reader);
688 if(result && reader)
689 Curl_creader_free(data, reader);
690 return result;
691}
693#endif /* CURL_DISABLE_HTTP */
Diagnostics4 git calls · 29 ms
CallStatusSizeTime029 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=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 · 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 · hit3 ms
git.upload-pack fetch http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=fetch git.upstream.dur_ms=22 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=86Open pack map
fetch2006.3 KiB · hit23 ms
git.upload-pack fetch http.response.status_code=200 git.response.bytes=6456 git.response.cache=HIT git.response.duration_ms=23 git.fetch.wants=2a84ce57c3589ed3d781a68bf0de3129c0a4d2c6 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=6456 git.pkt.payload.max=6435 git.sideband.band1.bytes=6434 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
- a5e208bf18a6c69c
- Request
- cafdadee…
- Protocol
- v2 · sha1
- Agent
- gitty/1.0
- Filter
- advertised
- Fetch
- shallow filter sideband-all
- Capabilities
- agent ls-refs fetch object-format