Artifactspublic-v0

curl

master
ply4 git calls39 ms288 KiB3 cachedprotocol v2
93 lines2.3 KiBRaw

NAME

curl_mime_subparts - set sub-parts of a multipart mime part

SYNOPSIS

c
#include <curl/curl.h>

CURLcode curl_mime_subparts(curl_mimepart *part, curl_mime *subparts);

DESCRIPTION

curl_mime_subparts(3) sets a multipart mime part's content from a mime structure.

part is a handle to the multipart part.

subparts is a mime structure handle holding the sub-parts. After curl_mime_subparts(3) succeeds, the mime structure handle belongs to the multipart part and must not be freed explicitly. It may however be updated by subsequent calls to mime API functions.

Setting a part's contents multiple times is valid: only the value set by the last call is retained. It is possible to unassign previous part's contents by setting subparts to NULL.

%PROTOCOLS%

EXAMPLE

c

static const char *inline_html = "<title>example</title>";
static const char *inline_text = "once upon the time";

int main(void)
{
  CURL *curl = curl_easy_init();
  if(curl) {
    struct curl_slist *slist;

    /* The inline part is an alternative proposing the html and the text
       versions of the email. */
    curl_mime *alt = curl_mime_init(curl);
    curl_mimepart *part;

    /* HTML message. */
    part = curl_mime_addpart(alt);
    curl_mime_data(part, inline_html, CURL_ZERO_TERMINATED);
    curl_mime_type(part, "text/html");

    /* Text message. */
    part = curl_mime_addpart(alt);
    curl_mime_data(part, inline_text, CURL_ZERO_TERMINATED);

    /* Create the inline part. */
    part = curl_mime_addpart(alt);
    curl_mime_subparts(part, alt);
    curl_mime_type(part, "multipart/alternative");
    slist = curl_slist_append(NULL, "Content-Disposition: inline");
    curl_mime_headers(part, slist, 1);
  }
}

%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_subparts
5Section: 3
6Source: libcurl
7See-also:
8 - curl_mime_addpart (3)
9 - curl_mime_init (3)
10Protocol:
11 - HTTP
12 - IMAP
13 - SMTP
14Added-in: 7.56.0
15---
17# NAME
19curl_mime_subparts - set sub-parts of a multipart mime part
21# SYNOPSIS
23~~~c
24#include <curl/curl.h>
26CURLcode curl_mime_subparts(curl_mimepart *part, curl_mime *subparts);
27~~~
29# DESCRIPTION
31curl_mime_subparts(3) sets a multipart mime part's content from a mime
32structure.
34*part* is a handle to the multipart part.
36*subparts* is a mime structure handle holding the sub-parts. After
37curl_mime_subparts(3) succeeds, the mime structure handle belongs to the
38multipart part and must not be freed explicitly. It may however be updated by
39subsequent calls to mime API functions.
41Setting a part's contents multiple times is valid: only the value set by the
42last call is retained. It is possible to unassign previous part's contents by
43setting *subparts* to NULL.
45# %PROTOCOLS%
47# EXAMPLE
49~~~c
51static const char *inline_html = "<title>example</title>";
52static const char *inline_text = "once upon the time";
54int main(void)
56 CURL *curl = curl_easy_init();
57 if(curl) {
58 struct curl_slist *slist;
60 /* The inline part is an alternative proposing the html and the text
61 versions of the email. */
62 curl_mime *alt = curl_mime_init(curl);
63 curl_mimepart *part;
65 /* HTML message. */
66 part = curl_mime_addpart(alt);
67 curl_mime_data(part, inline_html, CURL_ZERO_TERMINATED);
68 curl_mime_type(part, "text/html");
70 /* Text message. */
71 part = curl_mime_addpart(alt);
72 curl_mime_data(part, inline_text, CURL_ZERO_TERMINATED);
74 /* Create the inline part. */
75 part = curl_mime_addpart(alt);
76 curl_mime_subparts(part, alt);
77 curl_mime_type(part, "multipart/alternative");
78 slist = curl_slist_append(NULL, "Content-Disposition: inline");
79 curl_mime_headers(part, slist, 1);
80 }
82~~~
84# %AVAILABILITY%
86# RETURN VALUE
88This function returns a CURLcode indicating success or error.
90CURLE_OK (0) means everything was OK, non-zero means an error occurred, see
91libcurl-errors(3). If CURLOPT_ERRORBUFFER(3) was set with curl_easy_setopt(3)
92there can be an error message stored in the error buffer when non-zero is
93returned.
Diagnostics4 git calls · 39 ms
CallStatusSizeTime039 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=33
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=86
Open pack map
fetch2001.1 KiB · hit33 ms
git.upload-pack fetch
http.response.status_code=200
git.response.bytes=1170
git.response.cache=HIT
git.response.duration_ms=33
git.fetch.wants=f705a276e3d2e380a01cafbd8849c61003e0f20f
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=1170
git.pkt.payload.max=1149
git.sideband.band1.bytes=1148
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
a5e3a8a5eabd2a83
Request
cd6d7a6c…
Protocol
v2 · sha1
Agent
gitty/1.0
Filter
advertised
Fetch
shallow filter sideband-all
Capabilities
agent ls-refs fetch object-format