cURL / Mailing Lists / curl-library / Single Mail

curl-library

continuation of an http session across two processes (two curl instances)

From: Security Guru <dmzfire_at_live.com>
Date: Sun, 17 Jul 2011 21:53:20 -0500

Appreciate if any can give me some pointers

I have two processes A and B.

Process A starts an http session with a web app and gathers certain

parameters (such as cookies and session id) and

passes them to process B.

Process B has a new curl instance, with curl_easy_init() and

puts the following piece of code, but fails to _continue_ the current session started by process A.

However, this code works perfectly in process A, from the point where it handed-over to process B.

Both processes are within the same device and same IP etc.

What am 'missing? How can 'observe (log http posts of curl to a file?). console is not available for in

this scenerio. Thanks a bunch.

========================================================

         curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, errorBuffer);

          curl_easy_setopt(curl, CURLOPT_URL, url1);

          curl_easy_setopt(curl, CURLOPT_HEADER, 1);

          curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1);

          curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 0L);

          curl_easy_setopt(curl, CURLOPT_VERBOSE, 0L);

          curl_easy_setopt(curl, CURLOPT_COOKIEFILE, ""); /* just to start the cookie engine */

          curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, writer_stringbuffer);

          curl_easy_setopt(curl, CURLOPT_WRITEDATA, &buffer);

      

        

            string c("buttonName=Continue&userResponse=");

            c.append("abcd");

            char * postinfo= (char *)(c.c_str());

            curl_easy_setopt(curl, CURLOPT_POSTFIELDS, postinfo);

          

            string ck("JESSIONID=");

            ck.append(jsescookie);

            char * postcookie= (char *)(ck.c_str());

            curl_easy_setopt(curl, CURLOPT_COOKIE, postcookie);

            string cr("http://localhost:8080/someapp/acctcheck.do;jsessionid=");

            cr.append(first_jsescookie);

            char * referer = (char *)(cr.c_str());

            curl_easy_setopt(curl,CURLOPT_REFERER, referer);

            curl_easy_setopt(curl, CURLOPT_POST, 1L);

             curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, writer_stringbuffer);

            buffer.clear();

            curl_easy_setopt(curl, CURLOPT_WRITEDATA, &buffer);

            result = curl_easy_perform(curl);

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