curl / Mailing Lists / curl-library / Single Mail
Buy commercial curl support from WolfSSL. We help you work out your issues, debug your libcurl applications, use the API, port to new platforms, add new features and more. With a team lead by the curl founder himself.

curl_mime dependency on CURL*

From: Mayoi Hachikuji via curl-library <>
Date: Sat, 27 Aug 2022 11:17:14 +0300


`curl_mime_init` requires an existing *easy_handle*, but it's not clear
what its purpose actually is, as the only information (documentation and
general internet combined) I can seem to find is
> it creates a handle to a new empty mime structure intended to be used
> with *easy_handle*
and I don't know enough about libcurl internals to infer what this
actually means by reading the source code.

The confusing part is that this does not immediately associate this
handle with the *easy_handle*. It still has to be added using
`curl_easy_setopt`. Does it mean that it's okay to attach this handle to
any other *easy_handle* that's not the one I created this handle with?
If so, I guess it wouldn't need an *easy_handle*, but this word
"intended" to me has a conotation that it's not a hard dependency.

There's also ability to add curl_mime* to curl_mimepart* using
`curl_mime_subparts`, regarding the above, does it mean that they cannot
ever be mixed in regard to what handle each of them was created with?

What I want to be sure of is if
> this curl_mime* can only ever be used with CURL* it was created with
is an invariant that I have to uphold for libcurl to work correctly.
Received on 2022-08-27