cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: "from memory" chunked upload

From: Benjamin Garrigues <benjamin.garrigues_at_gmail.com>
Date: Thu, 8 Dec 2005 10:39:21 +0100

Hi, glad you've answered so fast !

Actually, a very simple way (API-wise) would be not to consider
READFUNCTION's callback returning "0" data read as a "end of transfer"
anymore, but instead as a "stop perform() execution, without closing the
connection" (or if it has to much impact on the API because of fread
returning 0, then do it on -1 return code). This way, I would be able to
continue my main loop to load new data into the source buffer and call
"perform" once more, until I really end the transfer by returning
"CURL_ENDOFTRANSFER".
(In my particular case, the source buffer itself knows if data it contains
is the last one or if more is to come, so the callback function will know
what it should return simply by asking the buffer).

I'm not sure I'm being very clear...The whole thing would be to be able to
stop perform() on a special callback's return code, and be able to call
perform() again once the source buffer has been refilled. What I don't know
if it is possible for you to break execution of perform() after a callback
and resume it later...

I would be glad to test anything you've done on this subject, and give you
feedback. I am currently working on the "xdflengine" open source project
(the sourceforge project is quite outdated) , and I am using libcurl to add
client-side network capabilities.

On 12/7/05, Daniel Stenberg <daniel_at_haxx.se> wrote:
>
> On Wed, 7 Dec 2005, Benjamin Garrigues wrote:
>
> > The buffer I wish to upload data from is alimented "chunks by chunks",
> thus
> > I may not have all the data inside when I start the upload. I would like
> to
> > upload what i got in the buffer, then "pause" the upload to insert new
> data,
> > then resume the upload. Is there any way I can have this behavior
> > (single-threaded) ?
>
> Short answer: no, this kind of operation is not supported at the moment.
>
> I have been wanting to add a mechnism for something like that for a long
> time
> though, so I wouldn't mind working with you to introduce something that
> would
> make libcurl support this...
>
> Any thoughts on how it could work, API-wise?
>
> --
> Commercial curl and libcurl Technical Support: http://haxx.se/curl.html
>
Received on 2005-12-08