cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: TLS security in Curl

From: Michael Wood <esiotrot_at_gmail.com>
Date: Wed, 5 Jan 2011 20:25:14 +0200

On 5 January 2011 19:26, amit paliwal <amit.ambitions_at_gmail.com> wrote:
>
> On Wed, Jan 5, 2011 at 12:15 PM, Michael Wood <esiotrot_at_gmail.com> wrote:
[...]
>> By the way, I am interested if you already have a server that you are
>> trying to talk to or if you still need to create the server.
>
> Yes, I do have the Server under construction for it, another party is
> building that Server, and it will be based on this concept only. And it says
> that "In contrast to long polling the HTTP response message (body) will not
> be closed after sending an event to the client. If an event occurs on the
> server-side, the server will write this event to the open response message
> body. The HTTP response message body represents a unidirectional event
> stream to the client."
>
> So how can this be done by HTTP, and if it is possibel to have teh response
> stream open, will Curl supports it?

Well, this seems like you need to do a normal request using
curl_easy_perform() and then the server will start sending back a
response when it has something to send. But instead of sending the
whole response, it will leave the connection open and continue sending
another part of the response later, and then another part later again.

Your client would then receive the first part of the reply in the
write callback and e.g. save it somewhere for another thread to do
something with. The callback would later receive the next part of the
response from the server and process it in the same way, etc. until
the server closed the connection or the connection broke or whatever.

If you wanted to send another request to the server in response to one
of the "chunks" saved by the write callback, you would have to create
a new curl handle and do a new curl_easy_perform(). Whether you used
the same write callback for the second curl_easy_perform() would
depend on the situation.

-- 
Michael Wood <esiotrot_at_gmail.com>
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2011-01-05