curl-library
Re: how to post a huge size file
Date: Wed, 26 Jan 2011 11:04:31 -0800
On Wed, Jan 26, 2011 at 01:13:49PM -0500, Hwasoo Lee wrote:
> I'm trying to upload a huge file incresing as time goes, in other
> words the size is
> not determined, to a http server using POST request.
>
> My problem is since a file size is not determined and keeps growing, I
> have to post
> it to a http server but I have to use POST request just once by the
> http server's requirement.
>
> curl_easy_perform is blocking until it finishs uploading but I need to
> keep checking the increased size to keep upload the rest of the size
> to the server.
> So I use curl_multi_perform to be non-block while using it.
>
> My question is that my approach is correct?
That will work, but isn't necessary. Yes, curl_easy_perform blocks, but
it calls the CURLOPT_READFUNCTION callback function whenever it needs to
send data. Your app can block in that callback function for as long as
necessary to wait for new data. When it's available, just return from
the callback and wait for it to be called again.
>>> Dan
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2011-01-26