Artifactspublic-v0

curl

master
ply4 git calls191 ms288 KiB2 cachedprotocol v2
77 lines1.7 KiBRaw

NAME

curl_mime_init - create a mime handle

SYNOPSIS

c
#include <curl/curl.h>

curl_mime *curl_mime_init(CURL *easy_handle);

DESCRIPTION

curl_mime_init(3) creates a handle to a new empty mime structure. This mime structure can be subsequently filled using the mime API, then attached to some easy handle using option CURLOPT_MIMEPOST(3) within a curl_easy_setopt(3) call or added as a multipart in another mime handle's part using curl_mime_subparts(3).

easy_handle is used for part separator randomization and error reporting. Since 7.87.0, it does not need to be the final target handle.

Using a mime handle is the recommended way to post an HTTP form, format and send a multi-part email with SMTP or upload such an email to an IMAP server.

%PROTOCOLS%

EXAMPLE

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

  /* Build an HTTP form with a single field named "data", */
  mime = curl_mime_init(easy);
  part = curl_mime_addpart(mime);
  curl_mime_data(part, "This is the field data", CURL_ZERO_TERMINATED);
  curl_mime_name(part, "data");

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

  /* Clean-up. */
  curl_easy_cleanup(easy);
  curl_mime_free(mime);
}

%AVAILABILITY%

RETURN VALUE

A mime struct handle, or NULL upon failure.

1---
2c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
3SPDX-License-Identifier: curl
4Title: curl_mime_init
5Section: 3
6Source: libcurl
7See-also:
8 - CURLOPT_MIMEPOST (3)
9 - curl_mime_addpart (3)
10 - curl_mime_free (3)
11 - curl_mime_subparts (3)
12Protocol:
13 - HTTP
14 - IMAP
15 - SMTP
16Added-in: 7.56.0
17---
19# NAME
21curl_mime_init - create a mime handle
23# SYNOPSIS
25~~~c
26#include <curl/curl.h>
28curl_mime *curl_mime_init(CURL *easy_handle);
29~~~
31# DESCRIPTION
33curl_mime_init(3) creates a handle to a new empty mime structure.
34This mime structure can be subsequently filled using the mime API, then
35attached to some easy handle using option CURLOPT_MIMEPOST(3) within
36a curl_easy_setopt(3) call or added as a multipart in another mime
37handle's part using curl_mime_subparts(3).
39*easy_handle* is used for part separator randomization and error
40reporting. Since 7.87.0, it does not need to be the final target handle.
42Using a mime handle is the recommended way to post an HTTP form, format and
43send a multi-part email with SMTP or upload such an email to an IMAP server.
45# %PROTOCOLS%
47# EXAMPLE
49~~~c
50int main(void)
52 CURL *easy = curl_easy_init();
53 curl_mime *mime;
54 curl_mimepart *part;
56 /* Build an HTTP form with a single field named "data", */
57 mime = curl_mime_init(easy);
58 part = curl_mime_addpart(mime);
59 curl_mime_data(part, "This is the field data", CURL_ZERO_TERMINATED);
60 curl_mime_name(part, "data");
62 /* Post and send it. */
63 curl_easy_setopt(easy, CURLOPT_MIMEPOST, mime);
64 curl_easy_setopt(easy, CURLOPT_URL, "https://example.com");
65 curl_easy_perform(easy);
67 /* Clean-up. */
68 curl_easy_cleanup(easy);
69 curl_mime_free(mime);
71~~~
73# %AVAILABILITY%
75# RETURN VALUE
77A mime struct handle, or NULL upon failure.
Diagnostics4 git calls · 191 ms
CallStatusSizeTime0191 ms
discover200152 B3 ms
git.upload-pack discover
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=ls-refs
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 · hit23 ms
git.upload-pack fetch
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=fetch
git.upstream.dur_ms=3
git.response.bytes=293470
git.response.cache=HIT
git.response.duration_ms=23
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
fetch200959 B165 ms
git.upload-pack fetch
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=fetch
git.upstream.dur_ms=165
git.response.bytes=959
git.response.cache=MISS
git.response.duration_ms=165
git.fetch.wants=7d1513dfbb21bf1aff2e64969a236ab83b88d92a
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=959
git.pkt.payload.max=938
git.sideband.band1.bytes=937
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
a5e34b13dd2a8a31
Request
66019be9…
Protocol
v2 · sha1
Agent
gitty/1.0
Filter
advertised
Fetch
shallow filter sideband-all
Capabilities
agent ls-refs fetch object-format