cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: (Q) suspension(and return) and resume while easy_perform(...)

From: Dan Fandrich <dan_at_coneharvesters.com>
Date: Tue, 20 Oct 2015 10:20:01 +0200

On Tue, Oct 20, 2015 at 12:14:27PM +0900, Taehwan Weon wrote:
> Hi,
>
> I am using easy APIs of libcurl.
> For more fine control, we am looking for a way to:
> (1) send a HTTP request
> (2) receive header of the response. 
> (3) some application works here. 
> (4) resume to receive the remaining response.
>
> Curl_easy_perform() does not return after receiving response header.
> We want to pass the curl session to the other thread and resume the remaining
> part.
>
> Any help would be highly appreciated.

It doesn't "return", but it does call a number of user-specified callback
functions at regular intervals, so the application can gain control at regular
intervals. However, the handle can't be transferred to a different thread at
this times because the call stack ends up going through curl functions. What
you appear to want to do can probably be done with the multi interface, as that
does actually return to the application regularly. You would have to be very
careful, naturally, and this isn't a recommended use case, but it would
probably work.

>>> Dan
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2015-10-20