curl_mime_name(3)
π curl_mime_name(3) β like, the whole manual, bestie
okay so this is a page from the Library Functions Manual β it's curl_mime_name(3), and it's genuinely one of the cutest little functions in libcurl. grab a strawberry drink π and let's get into it.
β¨ NAME β¨
curl_mime_name β set a mime part's name (yes, that's literally it, and yes, it's iconic)
π SYNOPSIS π
#include <curl/curl.h>
CURLcode curl_mime_name(curl_mimepart *part, const char *name);
π¦ DESCRIPTION π¦
Okay so here's the vibe: curl_mime_name(3) sets a mime part's name. That's the way HTTP form fields are named, iykyk. no cap, this is the function doing the naming.
part is the part's handle β the thing you're assigning a name to. main character energy.
name points to the null-terminated name string. simple.
Now the important bit, pay attention bestie: the name string gets copied into the part, so the associated storage may safely be released or reused after the call. π«Ά you don't have to keep it alive, it's fine, let it go.
Setting a part's name multiple times is valid β only the value set by the last call is retained. last one wins, periodt. π
And you can reset the name of a part by setting name to NULL. poof, gone. π§
π PROTOCOLS π
this functionality affects http, imap and smtp π
π₯ EXAMPLE π₯
here's the whole thing, verbatim, no edits:
int main(void)
{
curl_mime *mime;
curl_mimepart *part;
CURL *curl = curl_easy_init();
if(curl) {
/* create a mime handle */
mime = curl_mime_init(curl);
/* add a part */
part = curl_mime_addpart(mime);
/* give the part a name */
curl_mime_name(part, "shoe_size");
}
}
"shoe_size" bestie. we're naming a shoe size. iconic. π
β AVAILABILITY β
Added in curl 7.56.0 β so it's been old enough to drive for a minute, ngl.
π RETURN VALUE π
This function returns a CURLcode indicating success or error.
CURLE_OK(0) means everything was OK β slay, we ate. β¨- non-zero means an error occurred, see
libcurl-errors(3)π - If
CURLOPT_ERRORBUFFER(3)was set withcurl_easy_setopt(3)there can be an error message stored in the error buffer when non-zero is returned. so helpful, fr fr.
reminder bestie: non-zero is not a vibe. check that error buffer. π
πΈ SEE ALSO πΈ
go read them, they're all part of the same little mime family π
and that's the page! footer vibes for the record: this is libcurl, dated 2026-10-12, and it's the curl_mime_name(3) page β mwah, love that for us. πβ¨
π¦ where this page comes from
- fedora 44: libcurl-devel 8.18.0-14.fc44 Β· curl
- fedora 44: libcurl-devel 8.18.0-14.fc44 Β· curl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms