Artifactspublic-v0

curl

master
ply4 git calls126 ms291 KiB2 cachedprotocol v2
326 lines12 KiBRaw

NAME

curl_formadd - add a section to a multipart form POST

SYNOPSIS

c
#include <curl/curl.h>

CURLFORMcode curl_formadd(struct curl_httppost **firstitem,
                          struct curl_httppost **lastitem, ...);

DESCRIPTION

This function is deprecated. Use curl_mime_init(3) instead.

curl_formadd() is used to append sections when building a multipart form post. Append one section at a time until you have added all the sections you want included and then you pass the firstitem pointer as parameter to CURLOPT_HTTPPOST(3). lastitem is set after each curl_formadd(3) call and on repeated invokes it should be left as set to allow repeated invokes to find the end of the list faster.

After the lastitem pointer follow the real arguments.

The pointers firstitem and lastitem should both be pointing to NULL in the first call to this function. All list-data is allocated by the function itself. You must call curl_formfree(3) on the firstitem after the form post has been done to free the resources.

Using POST with HTTP 1.1 implies the use of a "Expect: 100-continue" header. You can disable this header with CURLOPT_HTTPHEADER(3) as usual.

First, there are some basics you need to understand about multipart form posts. Each part consists of at least a NAME and a CONTENTS part. If the part is made for file upload, there are also a stored CONTENT-TYPE and a FILENAME. Below, we discuss what options you use to set these properties in the parts you want to add to your post.

The options listed first are for making normal parts. The options from CURLFORM_FILE through CURLFORM_BUFFERLENGTH are for file upload parts.

OPTIONS

CURLFORM_COPYNAME

followed by a string which provides the name of this part. libcurl copies the string so your application does not need to keep it around after this function call. If the name is not null-terminated, you must set its length with CURLFORM_NAMELENGTH. The name is not allowed to contain zero-valued bytes. The copied data is freed by curl_formfree(3).

CURLFORM_PTRNAME

followed by a string which provides the name of this part. libcurl uses the pointer and refer to the data in your application, so you must make sure it remains until curl no longer needs it. If the name is not null-terminated, you must set its length with CURLFORM_NAMELENGTH. The name is not allowed to contain zero-valued bytes.

CURLFORM_COPYCONTENTS

followed by a pointer to the contents of this part, the actual data to send away. libcurl copies the provided data, so your application does not need to keep it around after this function call. If the data is not null-terminated, or if you would like it to contain zero bytes, you must set the length of the name with CURLFORM_CONTENTSLENGTH. The copied data is freed by curl_formfree(3).

CURLFORM_PTRCONTENTS

followed by a pointer to the contents of this part, the actual data to send away. libcurl uses the pointer and refer to the data in your application, so you must make sure it remains until curl no longer needs it. If the data is not null-terminated, or if you would like it to contain zero bytes, you must set its length with CURLFORM_CONTENTSLENGTH.

CURLFORM_CONTENTLEN

followed by a curl_off_t value giving the length of the contents. Note that for CURLFORM_STREAM contents, this option is mandatory.

If you pass a 0 (zero) for this option, libcurl calls strlen() on the contents to figure out the size. If you really want to send a zero byte content then you must make sure strlen() on the data pointer returns zero.

CURLFORM_CONTENTSLENGTH

(This option is deprecated. Use CURLFORM_CONTENTLEN instead.)

followed by a long giving the length of the contents. Note that for CURLFORM_STREAM contents, this option is mandatory.

If you pass a 0 (zero) for this option, libcurl calls strlen() on the contents to figure out the size. If you really want to send a zero byte content then you must make sure strlen() on the data pointer returns zero.

CURLFORM_NAMELENGTH

followed by a long giving the length of the name. Pass this option to set the length of CURLFORM_COPYNAME and CURLFORM_PTRNAME strings, if they are not null-terminated.

If you pass a 0 (zero) for this option, libcurl calls strlen() on the name to figure out the size. If you really want to send a zero byte name then you must make sure strlen() on the name pointer returns zero.

CURLFORM_FILECONTENT

followed by a filename, causes that file to be read and its contents used as data in this part. This part does not automatically become a file upload part due to its data being read from a file.

The specified file needs to kept around until the associated transfer is done.

CURLFORM_FILE

followed by a filename, makes this part a file upload part. It sets the filename field to the basename of the provided filename, it reads the contents of the file and passes them as data and sets the content-type if the given file match one of the internally known file extensions. For CURLFORM_FILE the user may send one or more files in one part by providing multiple CURLFORM_FILE arguments each followed by the filename (and each CURLFORM_FILE is allowed to have a CURLFORM_CONTENTTYPE).

The given upload file has to exist in its full in the file system already when the upload starts, as libcurl needs to read the correct file size beforehand.

The specified file needs to kept around until the associated transfer is done.

CURLFORM_CONTENTTYPE

is used in combination with CURLFORM_FILE. Followed by a pointer to a string which provides the content-type for this part, possibly instead of an internally chosen one.

CURLFORM_FILENAME

is used in combination with CURLFORM_FILE. Followed by a pointer to a string, it tells libcurl to use the given string as the filename in the file upload part instead of the actual filename.

CURLFORM_BUFFER

is used for custom file upload parts without use of CURLFORM_FILE. It tells libcurl that the file contents are already present in a buffer. The parameter is a string which provides the filename field in the content header.

CURLFORM_BUFFERPTR

is used in combination with CURLFORM_BUFFER. The parameter is a pointer to the buffer to be uploaded. This buffer must not be freed until after curl_easy_cleanup(3) is called. You must also use CURLFORM_BUFFERLENGTH to set the number of bytes in the buffer.

CURLFORM_BUFFERLENGTH

is used in combination with CURLFORM_BUFFER. The parameter is a long which gives the length of the buffer.

CURLFORM_STREAM

Tells libcurl to use the CURLOPT_READFUNCTION(3) callback to get data. The parameter you pass to CURLFORM_STREAM is the pointer passed on to the read callback's fourth argument. If you want the part to look like a file upload one, set the CURLFORM_FILENAME parameter as well. Note that when using CURLFORM_STREAM, CURLFORM_CONTENTSLENGTH must also be set with the total expected length of the part unless the formpost is sent chunked encoded.

CURLFORM_ARRAY

Another possibility to send options to curl_formadd() is the CURLFORM_ARRAY option, that passes a struct curl_forms array pointer as its value. Each curl_forms structure element has a CURLformoption and a char pointer. The final element in the array must be a CURLFORM_END. All available options can be used in an array, except the CURLFORM_ARRAY option itself. The last argument in such an array must always be CURLFORM_END.

CURLFORM_CONTENTHEADER

specifies extra headers for the form POST section. This takes a curl_slist prepared in the usual way using curl_slist_append and appends the list of headers to those libcurl automatically generates. The list must exist while the POST occurs, if you free it before the post completes you may experience problems.

When you have passed the struct curl_httppost pointer to curl_easy_setopt(3) (using the CURLOPT_HTTPPOST(3) option), you must not free the list until after you have called curl_easy_cleanup(3) for the curl handle.

See example below.

%PROTOCOLS%

EXAMPLE

c
#include <string.h> /* for strlen */

static const char record[] = "data in a buffer";

int main(void)
{
  CURL *curl = curl_easy_init();
  if(curl) {
    struct curl_httppost *post = NULL;
    struct curl_httppost *last = NULL;
    char namebuffer[] = "name buffer";
    size_t namelength = strlen(namebuffer);
    char buffer[] = "test buffer";
    char htmlbuffer[] = "<HTML>test buffer</HTML>";
    size_t htmlbufferlength = strlen(htmlbuffer);
    struct curl_forms forms[3];
    char file1[] = "my-face.jpg";
    char file2[] = "your-face.jpg";
    /* add null character into htmlbuffer, to demonstrate that
       transfers of buffers containing null characters actually work
     */
    htmlbuffer[8] = '\0';

    /* Add simple name/content section */
    curl_formadd(&post, &last, CURLFORM_COPYNAME, "name",
                 CURLFORM_COPYCONTENTS, "content", CURLFORM_END);

    /* Add simple name/content/contenttype section */
    curl_formadd(&post, &last, CURLFORM_COPYNAME, "htmlcode",
                 CURLFORM_COPYCONTENTS, "<HTML></HTML>",
                 CURLFORM_CONTENTTYPE, "text/html", CURLFORM_END);

    /* Add name/ptrcontent section */
    curl_formadd(&post, &last, CURLFORM_COPYNAME, "name_for_ptrcontent",
                 CURLFORM_PTRCONTENTS, buffer, CURLFORM_END);

    /* Add ptrname/ptrcontent section */
    curl_formadd(&post, &last, CURLFORM_PTRNAME, namebuffer,
                 CURLFORM_PTRCONTENTS, buffer, CURLFORM_NAMELENGTH,
                 (long)namelength, CURLFORM_END);

    /* Add name/ptrcontent/contenttype section */
    curl_formadd(&post, &last, CURLFORM_COPYNAME, "html_code_with_hole",
                 CURLFORM_PTRCONTENTS, htmlbuffer,
                 CURLFORM_CONTENTSLENGTH, (long)htmlbufferlength,
                 CURLFORM_CONTENTTYPE, "text/html", CURLFORM_END);

    /* Add simple file section */
    curl_formadd(&post, &last, CURLFORM_COPYNAME, "picture",
                 CURLFORM_FILE, "my-face.jpg", CURLFORM_END);

    /* Add file/contenttype section */
    curl_formadd(&post, &last, CURLFORM_COPYNAME, "picture",
                 CURLFORM_FILE, "my-face.jpg",
                 CURLFORM_CONTENTTYPE, "image/jpeg", CURLFORM_END);

    /* Add two file section */
    curl_formadd(&post, &last, CURLFORM_COPYNAME, "pictures",
                 CURLFORM_FILE, "my-face.jpg",
                 CURLFORM_FILE, "your-face.jpg", CURLFORM_END);

    /* Add two file section using CURLFORM_ARRAY */
    forms[0].option = CURLFORM_FILE;
    forms[0].value  = file1;
    forms[1].option = CURLFORM_FILE;
    forms[1].value  = file2;
    forms[2].option = CURLFORM_END;

    /* Add a buffer to upload */
    curl_formadd(&post, &last,
                 CURLFORM_COPYNAME, "name",
                 CURLFORM_BUFFER, "data",
                 CURLFORM_BUFFERPTR, record,
                 CURLFORM_BUFFERLENGTH, (long)sizeof(record),
                 CURLFORM_END);

    /* no option needed for the end marker */
    curl_formadd(&post, &last, CURLFORM_COPYNAME, "pictures",
                 CURLFORM_ARRAY, forms, CURLFORM_END);
    /* Add the content of a file as a normal post text value */
    curl_formadd(&post, &last, CURLFORM_COPYNAME, "filecontent",
                 CURLFORM_FILECONTENT, ".bashrc", CURLFORM_END);
    /* Set the form info */
    curl_easy_setopt(curl, CURLOPT_HTTPPOST, post);

    curl_easy_perform(curl);

    curl_easy_cleanup(curl);

    curl_formfree(post);
  }
}

DEPRECATED

Deprecated in 7.56.0. Before this release, field names were allowed to contain zero-valued bytes. The pseudo-filename "-" to read stdin is discouraged although still supported, but data is not read before being actually sent: the effective data size can then not be automatically determined, resulting in a chunked encoding transfer. Backslashes and double quotes in field and filenames are now escaped before transmission.

%AVAILABILITY%

RETURN VALUE

0 means everything was OK, non-zero means an error occurred corresponding to a CURL_FORMADD_* constant defined in <curl/curl.h>.

1---
2c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
3SPDX-License-Identifier: curl
4Title: curl_formadd
5Section: 3
6Source: libcurl
7See-also:
8 - curl_easy_setopt (3)
9 - curl_formfree (3)
10 - curl_mime_init (3)
11Protocol:
12 - HTTP
13Added-in: 7.1
14---
16# NAME
18curl_formadd - add a section to a multipart form POST
20# SYNOPSIS
22~~~c
23#include <curl/curl.h>
25CURLFORMcode curl_formadd(struct curl_httppost **firstitem,
26 struct curl_httppost **lastitem, ...);
27~~~
29# DESCRIPTION
31**This function is deprecated.** Use curl_mime_init(3) instead.
33curl_formadd() is used to append sections when building a multipart form
34post. Append one section at a time until you have added all the sections you
35want included and then you pass the *firstitem* pointer as parameter to
36CURLOPT_HTTPPOST(3). *lastitem* is set after each curl_formadd(3) call and
37on repeated invokes it should be left as set to allow repeated invokes to find
38the end of the list faster.
40After the *lastitem* pointer follow the real arguments.
42The pointers *firstitem* and *lastitem* should both be pointing to
43NULL in the first call to this function. All list-data is allocated by the
44function itself. You must call curl_formfree(3) on the *firstitem*
45after the form post has been done to free the resources.
47Using POST with HTTP 1.1 implies the use of a "Expect: 100-continue" header.
48You can disable this header with CURLOPT_HTTPHEADER(3) as usual.
50First, there are some basics you need to understand about multipart form
51posts. Each part consists of at least a NAME and a CONTENTS part. If the part
52is made for file upload, there are also a stored CONTENT-TYPE and a FILENAME.
53Below, we discuss what options you use to set these properties in the parts
54you want to add to your post.
56The options listed first are for making normal parts. The options from
57*CURLFORM_FILE* through *CURLFORM_BUFFERLENGTH* are for file upload
58parts.
60# OPTIONS
62## CURLFORM_COPYNAME
64followed by a string which provides the *name* of this part. libcurl
65copies the string so your application does not need to keep it around after
66this function call. If the name is not null-terminated, you must set its
67length with **CURLFORM_NAMELENGTH**. The *name* is not allowed to
68contain zero-valued bytes. The copied data is freed by curl_formfree(3).
70## CURLFORM_PTRNAME
72followed by a string which provides the *name* of this part. libcurl uses the
73pointer and refer to the data in your application, so you must make sure it
74remains until curl no longer needs it. If the name is not null-terminated, you
75must set its length with **CURLFORM_NAMELENGTH**. The *name* is not allowed to
76contain zero-valued bytes.
78## CURLFORM_COPYCONTENTS
80followed by a pointer to the contents of this part, the actual data to send
81away. libcurl copies the provided data, so your application does not need to
82keep it around after this function call. If the data is not null-terminated,
83or if you would like it to contain zero bytes, you must set the length of the
84name with **CURLFORM_CONTENTSLENGTH**. The copied data is freed by
85curl_formfree(3).
87## CURLFORM_PTRCONTENTS
89followed by a pointer to the contents of this part, the actual data to send
90away. libcurl uses the pointer and refer to the data in your application, so
91you must make sure it remains until curl no longer needs it. If the data is
92not null-terminated, or if you would like it to contain zero bytes, you must
93set its length with **CURLFORM_CONTENTSLENGTH**.
95## CURLFORM_CONTENTLEN
97followed by a curl_off_t value giving the length of the contents. Note that
98for *CURLFORM_STREAM* contents, this option is mandatory.
100If you pass a 0 (zero) for this option, libcurl calls strlen() on the contents
101to figure out the size. If you really want to send a zero byte content then
102you must make sure strlen() on the data pointer returns zero.
104## CURLFORM_CONTENTSLENGTH
106(This option is deprecated. Use *CURLFORM_CONTENTLEN* instead.)
108followed by a long giving the length of the contents. Note that for
109*CURLFORM_STREAM* contents, this option is mandatory.
111If you pass a 0 (zero) for this option, libcurl calls strlen() on the contents
112to figure out the size. If you really want to send a zero byte content then
113you must make sure strlen() on the data pointer returns zero.
115## CURLFORM_NAMELENGTH
117followed by a long giving the length of the name. Pass this option to set
118the length of *CURLFORM_COPYNAME* and *CURLFORM_PTRNAME* strings, if they are
119not null-terminated.
121If you pass a 0 (zero) for this option, libcurl calls strlen() on the name to
122figure out the size. If you really want to send a zero byte name then you must
123make sure strlen() on the name pointer returns zero.
125## CURLFORM_FILECONTENT
127followed by a filename, causes that file to be read and its contents used
128as data in this part. This part does *not* automatically become a file
129upload part due to its data being read from a file.
131The specified file needs to kept around until the associated transfer is done.
133## CURLFORM_FILE
135followed by a filename, makes this part a file upload part. It sets the
136*filename* field to the basename of the provided filename, it reads the
137contents of the file and passes them as data and sets the content-type if the
138given file match one of the internally known file extensions. For
139**CURLFORM_FILE** the user may send one or more files in one part by
140providing multiple **CURLFORM_FILE** arguments each followed by the filename
141(and each *CURLFORM_FILE* is allowed to have a
142*CURLFORM_CONTENTTYPE*).
144The given upload file has to exist in its full in the file system already when
145the upload starts, as libcurl needs to read the correct file size beforehand.
147The specified file needs to kept around until the associated transfer is done.
149## CURLFORM_CONTENTTYPE
151is used in combination with *CURLFORM_FILE*. Followed by a pointer to a
152string which provides the content-type for this part, possibly instead of an
153internally chosen one.
155## CURLFORM_FILENAME
157is used in combination with *CURLFORM_FILE*. Followed by a pointer to a
158string, it tells libcurl to use the given string as the *filename* in the file
159upload part instead of the actual filename.
161## CURLFORM_BUFFER
163is used for custom file upload parts without use of *CURLFORM_FILE*. It
164tells libcurl that the file contents are already present in a buffer. The
165parameter is a string which provides the *filename* field in the content
166header.
168## CURLFORM_BUFFERPTR
170is used in combination with *CURLFORM_BUFFER*. The parameter is a pointer
171to the buffer to be uploaded. This buffer must not be freed until after
172curl_easy_cleanup(3) is called. You must also use
173*CURLFORM_BUFFERLENGTH* to set the number of bytes in the buffer.
175## CURLFORM_BUFFERLENGTH
177is used in combination with *CURLFORM_BUFFER*. The parameter is a
178long which gives the length of the buffer.
180## CURLFORM_STREAM
182Tells libcurl to use the CURLOPT_READFUNCTION(3) callback to get data. The
183parameter you pass to *CURLFORM_STREAM* is the pointer passed on to the read
184callback's fourth argument. If you want the part to look like a file upload
185one, set the *CURLFORM_FILENAME* parameter as well. Note that when using
186*CURLFORM_STREAM*, *CURLFORM_CONTENTSLENGTH* must also be set with the total
187expected length of the part unless the formpost is sent chunked encoded.
189## CURLFORM_ARRAY
191Another possibility to send options to curl_formadd() is the
192**CURLFORM_ARRAY** option, that passes a struct curl_forms array pointer as
193its value. Each curl_forms structure element has a *CURLformoption* and a
194char pointer. The final element in the array must be a CURLFORM_END. All
195available options can be used in an array, except the CURLFORM_ARRAY option
196itself. The last argument in such an array must always be **CURLFORM_END**.
198## CURLFORM_CONTENTHEADER
200specifies extra headers for the form POST section. This takes a curl_slist
201prepared in the usual way using **curl_slist_append** and appends the list
202of headers to those libcurl automatically generates. The list must exist while
203the POST occurs, if you free it before the post completes you may experience
204problems.
206When you have passed the *struct curl_httppost* pointer to
207curl_easy_setopt(3) (using the CURLOPT_HTTPPOST(3) option), you
208must not free the list until after you have called curl_easy_cleanup(3)
209for the curl handle.
211See example below.
213# %PROTOCOLS%
215# EXAMPLE
217~~~c
218#include <string.h> /* for strlen */
220static const char record[] = "data in a buffer";
222int main(void)
224 CURL *curl = curl_easy_init();
225 if(curl) {
226 struct curl_httppost *post = NULL;
227 struct curl_httppost *last = NULL;
228 char namebuffer[] = "name buffer";
229 size_t namelength = strlen(namebuffer);
230 char buffer[] = "test buffer";
231 char htmlbuffer[] = "<HTML>test buffer</HTML>";
232 size_t htmlbufferlength = strlen(htmlbuffer);
233 struct curl_forms forms[3];
234 char file1[] = "my-face.jpg";
235 char file2[] = "your-face.jpg";
236 /* add null character into htmlbuffer, to demonstrate that
237 transfers of buffers containing null characters actually work
238 */
239 htmlbuffer[8] = '\0';
241 /* Add simple name/content section */
242 curl_formadd(&post, &last, CURLFORM_COPYNAME, "name",
243 CURLFORM_COPYCONTENTS, "content", CURLFORM_END);
245 /* Add simple name/content/contenttype section */
246 curl_formadd(&post, &last, CURLFORM_COPYNAME, "htmlcode",
247 CURLFORM_COPYCONTENTS, "<HTML></HTML>",
248 CURLFORM_CONTENTTYPE, "text/html", CURLFORM_END);
250 /* Add name/ptrcontent section */
251 curl_formadd(&post, &last, CURLFORM_COPYNAME, "name_for_ptrcontent",
252 CURLFORM_PTRCONTENTS, buffer, CURLFORM_END);
254 /* Add ptrname/ptrcontent section */
255 curl_formadd(&post, &last, CURLFORM_PTRNAME, namebuffer,
256 CURLFORM_PTRCONTENTS, buffer, CURLFORM_NAMELENGTH,
257 (long)namelength, CURLFORM_END);
259 /* Add name/ptrcontent/contenttype section */
260 curl_formadd(&post, &last, CURLFORM_COPYNAME, "html_code_with_hole",
261 CURLFORM_PTRCONTENTS, htmlbuffer,
262 CURLFORM_CONTENTSLENGTH, (long)htmlbufferlength,
263 CURLFORM_CONTENTTYPE, "text/html", CURLFORM_END);
265 /* Add simple file section */
266 curl_formadd(&post, &last, CURLFORM_COPYNAME, "picture",
267 CURLFORM_FILE, "my-face.jpg", CURLFORM_END);
269 /* Add file/contenttype section */
270 curl_formadd(&post, &last, CURLFORM_COPYNAME, "picture",
271 CURLFORM_FILE, "my-face.jpg",
272 CURLFORM_CONTENTTYPE, "image/jpeg", CURLFORM_END);
274 /* Add two file section */
275 curl_formadd(&post, &last, CURLFORM_COPYNAME, "pictures",
276 CURLFORM_FILE, "my-face.jpg",
277 CURLFORM_FILE, "your-face.jpg", CURLFORM_END);
279 /* Add two file section using CURLFORM_ARRAY */
280 forms[0].option = CURLFORM_FILE;
281 forms[0].value = file1;
282 forms[1].option = CURLFORM_FILE;
283 forms[1].value = file2;
284 forms[2].option = CURLFORM_END;
286 /* Add a buffer to upload */
287 curl_formadd(&post, &last,
288 CURLFORM_COPYNAME, "name",
289 CURLFORM_BUFFER, "data",
290 CURLFORM_BUFFERPTR, record,
291 CURLFORM_BUFFERLENGTH, (long)sizeof(record),
292 CURLFORM_END);
294 /* no option needed for the end marker */
295 curl_formadd(&post, &last, CURLFORM_COPYNAME, "pictures",
296 CURLFORM_ARRAY, forms, CURLFORM_END);
297 /* Add the content of a file as a normal post text value */
298 curl_formadd(&post, &last, CURLFORM_COPYNAME, "filecontent",
299 CURLFORM_FILECONTENT, ".bashrc", CURLFORM_END);
300 /* Set the form info */
301 curl_easy_setopt(curl, CURLOPT_HTTPPOST, post);
303 curl_easy_perform(curl);
305 curl_easy_cleanup(curl);
307 curl_formfree(post);
308 }
310~~~
312# DEPRECATED
314Deprecated in 7.56.0. Before this release, field names were allowed to contain
315zero-valued bytes. The pseudo-filename "-" to read stdin is discouraged
316although still supported, but data is not read before being actually sent: the
317effective data size can then not be automatically determined, resulting in a
318chunked encoding transfer. Backslashes and double quotes in field and
319filenames are now escaped before transmission.
321# %AVAILABILITY%
323# RETURN VALUE
3250 means everything was OK, non-zero means an error occurred corresponding to a
326`CURL_FORMADD_*` constant defined in *\<curl/curl.h\>*.
Diagnostics4 git calls · 126 ms
CallStatusSizeTime0126 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 · 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=120
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
fetch2004.1 KiB121 ms
git.upload-pack fetch
http.response.status_code=200
git.response.bytes=4232
git.response.cache=MISS
git.response.duration_ms=121
git.fetch.wants=d98469578f981daf179185aecc332f0029318b00
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=4232
git.pkt.payload.max=4211
git.sideband.band1.bytes=4210
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
a5e33b794e40f162
Request
343ceb73…
Protocol
v2 · sha1
Agent
gitty/1.0
Filter
advertised
Fetch
shallow filter sideband-all
Capabilities
agent ls-refs fetch object-format