cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Reading from a stream

From: Robert Bielik <robert.bielik_at_xponaut.se>
Date: Thu, 27 Mar 2008 16:35:50 +0100

Daniel Stenberg skrev:
> That's exactly what libcurl offers, but since you say you want a
> multi-part formpost you don't want "without curl knowing anything", you
> rather seem to want it to format it accordingly and when offering that
> formatting it no longer offers that same read callback approach.
>

I was thinking along the lines of:
A. Add a CURLFORM_STREAM option to which I hand any user given pointer like so:

curl_formadd(&formpost,
                &lastptr,
                CURLFORM_COPYNAME, fileNameParameter.toUTF8(),
                CURLFORM_STREAM, m_uploadFileStream,
                CURLFORM_CONTENTSLENGTH, (long)m_uploadFileStream->getTotalLength(),
                CURLFORM_END);

which sets the flag to HTTPPOST_STREAM (1<<6)

B. Add a formtype FORM_STREAM for the HTTPPOST_STREAM flag above

C. When a FORM_STREAM part is uploaded, data is read from the user pointer given in step A via
    the curl_read_callback.

Am I thinking correctly?

TIA
/R
Received on 2008-03-27