Artifactspublic-v0

curl

master
ply4 git calls490 ms288 KiB2 cachedprotocol v2
88 lines2.0 KiBRaw

NAME

curl_mime_headers - set a mime part's custom headers

SYNOPSIS

c
#include <curl/curl.h>

CURLcode curl_mime_headers(curl_mimepart *part,
                           struct curl_slist *headers, int take_ownership);

DESCRIPTION

curl_mime_headers(3) sets a mime part's custom headers.

part is the part's handle to assign the custom headers list to.

headers is the head of a list of custom headers; it may be set to NULL to remove a previously attached custom header list.

take_ownership: when non-zero, causes the list to be freed upon replacement or mime structure deletion; in this case the list must not be freed explicitly.

Setting a part's custom headers list multiple times is valid: only the value set by the last call is retained.

%PROTOCOLS%

EXAMPLE

c
int main(void)
{
  struct curl_slist *headers = NULL;
  CURL *easy = curl_easy_init();
  curl_mime *mime;
  curl_mimepart *part;

  headers = curl_slist_append(headers, "Custom-Header: mooo");

  mime = curl_mime_init(easy);
  part = curl_mime_addpart(mime);

  /* use these headers in the part, takes ownership */
  curl_mime_headers(part, headers, 1);

  /* pass on this data */
  curl_mime_data(part, "12345679", CURL_ZERO_TERMINATED);

  /* set name */
  curl_mime_name(part, "numbers");

  /* Post and send it. */
  curl_easy_setopt(easy, CURLOPT_MIMEPOST, mime);
  curl_easy_setopt(easy, CURLOPT_URL, "https://example.com");
  curl_easy_perform(easy);
}

%AVAILABILITY%

RETURN VALUE

This function returns a CURLcode indicating success or error.

CURLE_OK (0) means everything was OK, non-zero means an error occurred, see libcurl-errors(3). If CURLOPT_ERRORBUFFER(3) was set with curl_easy_setopt(3) there can be an error message stored in the error buffer when non-zero is returned.

1---
2c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
3SPDX-License-Identifier: curl
4Title: curl_mime_headers
5Section: 3
6Source: libcurl
7See-also:
8 - curl_mime_addpart (3)
9 - curl_mime_name (3)
10Protocol:
11 - HTTP
12 - IMAP
13 - SMTP
14Added-in: 7.56.0
15---
17# NAME
19curl_mime_headers - set a mime part's custom headers
21# SYNOPSIS
23~~~c
24#include <curl/curl.h>
26CURLcode curl_mime_headers(curl_mimepart *part,
27 struct curl_slist *headers, int take_ownership);
28~~~
30# DESCRIPTION
32curl_mime_headers(3) sets a mime part's custom headers.
34*part* is the part's handle to assign the custom headers list to.
36*headers* is the head of a list of custom headers; it may be set to NULL
37to remove a previously attached custom header list.
39*take_ownership*: when non-zero, causes the list to be freed upon
40replacement or mime structure deletion; in this case the list must not be
41freed explicitly.
43Setting a part's custom headers list multiple times is valid: only the value
44set by the last call is retained.
46# %PROTOCOLS%
48# EXAMPLE
50~~~c
51int main(void)
53 struct curl_slist *headers = NULL;
54 CURL *easy = curl_easy_init();
55 curl_mime *mime;
56 curl_mimepart *part;
58 headers = curl_slist_append(headers, "Custom-Header: mooo");
60 mime = curl_mime_init(easy);
61 part = curl_mime_addpart(mime);
63 /* use these headers in the part, takes ownership */
64 curl_mime_headers(part, headers, 1);
66 /* pass on this data */
67 curl_mime_data(part, "12345679", CURL_ZERO_TERMINATED);
69 /* set name */
70 curl_mime_name(part, "numbers");
72 /* Post and send it. */
73 curl_easy_setopt(easy, CURLOPT_MIMEPOST, mime);
74 curl_easy_setopt(easy, CURLOPT_URL, "https://example.com");
75 curl_easy_perform(easy);
77~~~
79# %AVAILABILITY%
81# RETURN VALUE
83This function returns a CURLcode indicating success or error.
85CURLE_OK (0) means everything was OK, non-zero means an error occurred, see
86libcurl-errors(3). If CURLOPT_ERRORBUFFER(3) was set with curl_easy_setopt(3)
87there can be an error message stored in the error buffer when non-zero is
88returned.
Diagnostics4 git calls · 490 ms
CallStatusSizeTime0490 ms
discover200152 B2 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=486
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
fetch2001.1 KiB486 ms
git.upload-pack fetch
http.response.status_code=200
git.response.bytes=1076
git.response.cache=MISS
git.response.duration_ms=486
git.fetch.wants=8c7770bd1e5c4baccc779c68905cc7637d4c14d9
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=1076
git.pkt.payload.max=1055
git.sideband.band1.bytes=1054
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
a5e3451add25f4d4
Request
2017e054…
Protocol
v2 · sha1
Agent
gitty/1.0
Filter
advertised
Fetch
shallow filter sideband-all
Capabilities
agent ls-refs fetch object-format