Re: curl_mime_data_cb() with curl_easy_duphandle()
Date: Tue, 7 Jan 2020 16:39:44 +0100
On 07.01.2020 at 16:26, Daniel Stenberg wrote:
> On Mon, 6 Jan 2020, Christoph M. Becker via curl-library wrote:
>
>> I do not understand, though, how it could be possible to deal with
>> handle-specific data in the arg structure, since I'm not aware how to
>> determine which cURL handle had called any of the callbacks. What am
>> I missing?
>
> Since there's a custom pointer provided for the callbacks, you always
> have the ability to pass in exactly whatever you want. That could
> include an identifier for transfer or a CURL handle pointer.
I could pass in a CURL handle pointer, but if that CURL handle is later
duplicated with curl_easy_duphandle(), both handles would share the same
structure, which still holds the original CURL handle. In other words,
whenever readfunc, seekfunc or freefunc set via curl_mime_data_cb() is
called, the functions get the same custom arg for all duplicated handles.
So it seems to me that wrt. duplicated handles and potentially
asynchronous execution (curl_multi_perform()) it is necessary to
actually rebuild the whole mime structure when a handle is duplicated,
and to set this as CURLOPT_MIMEPOST for the duplicated handle.
-- Christoph M. Becker ------------------------------------------------------------------- Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library Etiquette: https://curl.haxx.se/mail/etiquette.htmlReceived on 2020-01-07