Re: Downloading multipart
Date: Wed, 31 May 2006 07:40:38 +0200 (CEST)
On Wed, 31 May 2006, Daniel Moore wrote:
> So I guess my point is that I'm thinking of multipart content and
> particularly x-mixed-replace content as a representation of data rather than
> data itself. I'm suggesting that libcurl could crack open the multipart
> content and provide each individual part of content back to the caller just
> like it does for an individual http request.
If we for a while assume we wanted to add this feature to the lib, how exactly
do you propose it would work?
Also, "x-mixed-replace" is not the key here but "multipart" is. Compare with
the byte stream provided by servers when two (with a gap) ranges are requested
> For the example of a http camera, every time the camera grabs a frame, it
> generats a new x-mixed-replace part and sends the frame. I'm suggesting that
> it would be nice if libcurl returned each part individually, thereby giving
> control back to the main program rather than remaining in libcurl_perform
Well, curl_easy_perform() will always be synchronous and will always "lock"
until the complete transfer is performed. So for your case the easy interface
doesn't sound right unless you use multiple threads.
> Now I know there's the multi stuff (although I haven't looked at it much
> yet), and it's a cool facility that would let one implement the multipart
> decoding as a consumer of libcurl.
Even if libcurl would support the chopping up of the download stream as you
suggest, you'd have to use the multi interface if you want to regain control
of the single thread between two parts are received.
> All I'm suggesting is that libcurl could handle the details of cracking open
> the multipart (content-length, boundaries, non-blocking io, buffering,
> callbacks etc - stuff it's already good at) and supply each part
> individually through the libcurl_perform interface.
libcurl currently has no support for anything like this so it would require
new stuff. You up to working on it/suggesting how it would work?
-- Commercial curl and libcurl Technical Support: http://haxx.se/curl.htmlReceived on 2006-05-31