cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Reading from a stream

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Thu, 27 Mar 2008 22:35:02 +0100 (CET)

On Thu, 27 Mar 2008, Robert Bielik wrote:

> 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?

Sure, it certainly sounds like a perfectly fine approach that I think would
not only follow the general libcurl concepts and style but also be a nice
addition for such usecases you've presented.

Remember that you'll get bonus points for providing test cases and docs
updates with your code changes!

-- 
  Commercial curl and libcurl Technical Support: http://haxx.se/curl.html
Received on 2008-03-27