cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: curl to reuse the session for https

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Wed, 19 Dec 2012 11:36:58 +0100 (CET)

On Tue, 18 Dec 2012, Indtiny s wrote:

(As we're talking libcurl I removed curl-users as a receiver of this mail.)

> I want to use the same session while reconnecting to server , I tried by
> adding cookie *curl_easy_setopt(curl, CURLOPT_COOKIEJAR,"seesion.id") *
>
> But when I tried reconeting to the server the connection goes again with the
> handshakes (like a fresh connection ) .

There is unfortunately no such thing as a simple generic "session" in HTTP.
You somehow need to figure out how to start the session and then you need to
maintain it in subsequent requests. The start of a session can be visting a
special page, a login or even running some custom javascript somewhere. It is
your job to figure out what it is and then use libcurl to run the session that
way. Maintaining the session if often mostly "just" a matter of keeping and
updated cookies along the way.

One popular way to track down how such a session works is to use
LiveHTTPHeaders or one of the recent browser's embedded debugging tools to
track exactly what your browser does against the site and then work on repeat
that with libcurl.

We've collected generic instructions and advice on how to "script HTTP" on
this page: http://curl.haxx.se/docs/httpscripting.html

I'm sure we'll be able to help more if you have specific questions going
further!

-- 
  / daniel.haxx.se
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2012-12-19