gnurl_mime_headers(3)
π gnurl_mime_headers(3) β bestie's guide to custom mime part headers
okay so we're in the libgnurl Manual (libgnurl, yes, the gnurl-flavoured curl docs) and today's main character is gnurl_mime_headers(3). buckle up, this one's short but she matters π
β¨ NAME β¨
curl_mime_headers β set a mime part's custom headers
(yes bestie, the function inside is called curl_mime_headers, the page is called gnurl_mime_headers. it's giving rebrand. don't overthink it π
)
πΈ SYNOPSIS πΈ
#include <gnurl/curl.h>
CURLcode curl_mime_headers(curl_mimepart * part, struct curl_slist *
headers, int take_ownership);
like all good things, she returns a CURLcode and takes three things. let's meet them π«Ά
π DESCRIPTION π
curl_mime_headers(3) sets a mime part's custom headers. that's the whole vibe. no cap.
partβ the part's handle you're assigning the custom headers list to. your little mime part bestie π§headersβ the head of a list of custom headers. and listen, it may be set toNULLto remove a previously attached custom header list. soNULLis not a bug, it's a personality reset β¨take_ownershipβ when non-zero, it causes the list to be freed upon replacement or mime structure deletion. in that case the list must not be freed explicitly. read that again. like, do not double-free her, she's taken π
lowkey important: setting a part's custom headers list twice is valid: only the value set by the last call is retained. so no drama, the newest one wins π
π¦ AVAILABILITY π¦
as long as at least one of HTTP, SMTP or IMAP is enabled. added in 7.56.0. so if you're on something ancient, sorry bestie, no headers for you π
β RETURN VALUE β
CURLE_OK or a CURL error code upon failure. that's it, that's the whole return value. check it, periodt π
π₯ EXAMPLE π₯
here's the glow-up demo, copied exactly so you can paste it and slay:
struct curl_slist *headers = NULL;
headers = curl_slist_append("Custom-Header: mooo", headers);
/* use these headers, please take ownership */
curl_mime_headers(part, headers, TRUE);
/* pass on this data */
curl_mime_data(part, "12345679", CURL_ZERO_TERMINATED);
/* set name */
curl_mime_name(part, "numbers");
the way she says "please take ownership" π iconic. and yes, that string is literally "Custom-Header: mooo". we love a cow moment π
π SEE ALSO π
curl_mime_addpart(3)β go read it, iykyk π«Ά
and that's the page! π no notes, she ate. this gem came from libcurl 7.56.0, dated 22 August 2017, and the page itself is gnurl_mime_headers(3) β love her, read her, use her responsibly ππ
π¦ where this page comes from
- nixos 26.05: libgnurl 7.72.0
- nixpkgs unstable: libgnurl 7.72.0
- Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms