Re: curl_easy_pause documentation question
Date: Wed, 9 Apr 2008 23:41:16 +0200 (CEST)
On Wed, 9 Apr 2008, Ben Combee wrote:
> Am I correct in assuming that the PAUSE return values are only valid for
> easy handles that are attached to a multi handle?
Nope, it works for either interface.
> It seems like if you'd called curl_easy_perform, there would be no way to
> unpause the handle.
There are multiple callbacks you can still use to unpause.
> Another documentation issue: if a write callback returns
> CURL_WRITEFUNC_PAUSE, what is the disposition of the data provided to the
> callback? Will it get sent again in the future when the stream is unpaused,
> or does libcurl expect that data to be consumed?
That's a good question and I'd appreciate your feedback on how to update the
docs to be more clear on this.
Returning pause is an indication that your callback DID NOT take care of the
data, and thus libcurl will instead keep the data until you unpause again and
then call the callback again offering the same data.
> My code is already working to a limited degree by doing a "pause everything"
> by withholding calls to curl_multi_perform. One thing I observed with the
> older versions was that libcurl would stop a transfer with an error if a
> write callback didn't absorb all of the data given to it. Now that we have
> the ability to pause, it would be nice to also allow partial writes, with
> the leftover data stored in libcurl until the next write callback For
> example, curl provides me with 4K of data, I absorb 2K of this data filling
> my own buffer, then call curl_easy_pause on the stream from the write
> callback and return 2K from the write call.
Yes, I considered that too but I then decided it wasn't worth that extra
effort so I left it so that you either consume it all or you pause. You can
always add an extra cache of your own if you want to consume only a piece of
it right now.
But if someone provides a patch making it work like you suggest, I don't think
-- Commercial curl and libcurl Technical Support: http://haxx.se/curl.htmlReceived on 2008-04-09