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
(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",
> > I may not have all the data inside when I start the upload. I would like
> > upload what i got in the buffer, then "pause" the upload to insert new
> > 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
> though, so I wouldn't mind working with you to introduce something that
> 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