curl-library
Re: libcurl multi interface interleave GET and POST calls
Date: Tue, 1 Feb 2011 09:54:31 -0500
On Tue, Feb 1, 2011 at 5:35 AM, Dirk Manske <dm_at_nonitor.de> wrote:
> On Tuesday 01 February 2011 01:17:59 Andrei Ionescu wrote:
>> My question here may be a very basic HTTP/libcurl
>> question but here is my situation:
>> - the client connects to the server and it can send data to it by issuing a POST
>> - the server will send data to the client in a POST
> What?
> The server cannot do a post to the client, unless you include
> a http-client in the server and a http-server in the client.
> I guess you mean s.t. different.
>
I was under the impression that the server can do a POST in response
to a GET from the client, which I mentioned below. If I'm wrong in
this assumption please let me know.
>> , but only if the
>> client performed a GET to the server (if no data is available then it
>> will not respond immediately)
> And what is the trigger for the GET request?
After the client connects to the server it will send a GET request in
order to allow the server to send data to the client in a POST. The
server doesn't need to send the POST to the client right away, but
when data is available. Also, after a POST is sent by the server and
the client process the data it will then issue another GET.
>
>> Can I use a single handle and pass it to libcurl's multi interface to
>> do all the above?
> If your client makes the GET and POST operations in serial (send one request
> and wait for answer before sending next request), then you don't need multi
> interface.
>
The GET and POST operations are not serial. The client will issue a
POST whenever it has data to send to the server, which could be at any
time. The GET is sent to the server just to allow the server to send
data to the client, and so there can be POSTs sent by the client at
any time before or after the GET, they're not related.
With the multi interface, it seems like you set up your easy handles
with the data that you want to send out, add it to the multi handle
then do a multi_perform on the multi handle. After this is done, how
do you send more data through the handles? Can you simply do a
curl_easy_setopt on the handles that have been added to the multi
handle? My impression is that I shouldn't modify the handles directly
after they've been added to the multi handle, but from looking at the
interface I don't see how you can send multiple commands on one
handle, without possibly first removing it from the multi handle.
>
> Greetings,
> Dirk.
> -------------------------------------------------------------------
> List admin: http://cool.haxx.se/list/listinfo/curl-library
> Etiquette: http://curl.haxx.se/mail/etiquette.html
>
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2011-02-01