cURL / Mailing Lists / curl-library / Single Mail

curl-library

curl to reuse the session for https

From: Indtiny s <indtiny_at_gmail.com>
Date: Tue, 18 Dec 2012 11:16:44 -0500

Hi,

I have written a below code to connect to HTTPS server to get some files ,
It works fine .

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 ) .

Can someones help me, how to use the session id properly while reconnecting
with the https server ..?

if(curl) {
    /* what call to write: */
    curl_easy_setopt(curl, CURLOPT_URL, "https://127.0.0.1");

     curl_easy_setopt(curl, CURLOPT_WRITEHEADER, headerfile);
     curl_easy_setopt(curl, CURLOPT_WRITEDATA, headerfile);

    while(1)

    {

      curl_easy_setopt(curl, CURLOPT_VERBOSE, 1);
      curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, buffer);

      curl_easy_setopt(curl,CURLOPT_SSLCERTTYPE,"PEM");
      curl_easy_setopt(curl,CURLOPT_SSLKEYTYPE,"PEM");

      curl_easy_setopt(curl,CURLOPT_SSLCERT,"SerPem.crt");

      curl_easy_setopt(curl,CURLOPT_SSLKEY,"key.pem");
      curl_easy_setopt(curl,CURLOPT_CAINFO,"root.x509.crt");
      curl_easy_setopt (curl, CURLOPT_CAPATH, "NewCerts/");

     curl_easy_setopt(curl, CURLOPT_COOKIEJAR,"seesion.id")

      /* disconnect if we can't validate server's cert */
      curl_easy_setopt(curl,CURLOPT_SSL_VERIFYPEER,1L);

      curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0L);

      /* Perform the request, res will get the return code */
      res = curl_easy_perform(curl);
      /* Check for errors */
      if(res != CURLE_OK)

  fprintf(stderr, "%d: %s\n", __LINE__, buffer);
        fprintf(stderr, "curl_easy_perform() failed: %s\n error%d",
                curl_easy_strerror(res),res);

      break;
    }

Rgds

Indra

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