cURL / Mailing Lists / curl-library / Single Mail

curl-library

RE: Problem with cookie

From: Mandar Wadekar <MandarW_at_HeyAnita.com>
Date: Tue, 16 Apr 2002 12:03:51 -0700

ok. I was able to force the cookie. Some formatting of the cookie was
necessary before I could send it such as removing trailing white spaces
or newline characters. I could get the page now. But the question
remains is, why I have to do this on windows when its *not* necessary on
Unix.

Furthermore, while trying various versions, I built 7.9.5 version. But
it consistently failed in I/O operations. I tracked down to following
line :

CURLcode Curl_client_write(struct SessionHandle *data,
                           int type,
                           char *ptr,
                           size_t len)
{
  size_t wrote;

  if(0 == len)
    len = strlen(ptr);

  if(type & CLIENTWRITE_BODY) {
/**************Following operation
fails************************************/
    wrote = data->set.fwrite(ptr, 1, len, data->set.out);
/***********************************************************************
****/
    if(wrote != len) {
      failf (data, "Failed writing body");
      return CURLE_WRITE_ERROR;
    }
  }
....
....
}

I checked the value of data->set.out and the FILE* I am setting. They
are same. There is no corruption of the pointer value.

I would appreciate if anyone could help me. Thanks.

-Mandar Wadekar
-----Original Message-----
From: Daniel Stenberg [mailto:daniel_at_haxx.se]
Sent: Friday, April 12, 2002 2:38 AM
To: Mandar Wadekar
Cc: libcurl Mailing list
Subject: RE: Problem with cookie

On Thu, 11 Apr 2002, Mandar Wadekar wrote:

> The First URL was like this :
>
http://servername/appserver/isapi.dll?application?mn_mainmenu.havbmainme
> nuclass&HASW&ANI123&DNIS123d&CALLERID123&undefined
> The Second URL would be something like
> http://servername/appserver/isapi.dll?RespondToApp?XYZ=abc&TYP=def

But what did the headers you received look like? What did the cookijar
contain afterwards?

We need to take this step by step to see what curl receives, what it
saves,
what it loads, and why it doesn't send the proper cookies in the second
request.

> To use CURLOPT_COOKIE, I read the cookie.ck file which was generated
by
> first request, stripped off the name,value pair from the cookie file
and
> the code looks like following :

> curl_easy_setopt(curl,CURLOPT_COOKIEFILE, cookieFileName );
>
> #ifdef _FORCE_COOKIE_
> _ReadCookie(); //this strips the cookie
> value from cookie.ck file generated in first request.
> strcpy(szCookie,"AppServerSyncFile=");
> strcat(szCookie,szCookieValue);
> strcat(szCookie,";");
> res = curl_easy_setopt(curl,
> CURLOPT_COOKIE, szCookie);
>
> #endif
> res = curl_easy_perform(curl);
>

... and what did the header look like when you issued this request?

> I have tried the same code on Unix (ofcourse with Unix version of
library)
> and it works perfect (without _FORCE_COOKIE). It gives me a feeling
that
> windows library behaves in different manner.

Ah, this makes the matter more complicated of course. The fact that it
works
on "unix" but not on windows indeed make it sound like a bug somewhere.

Since you obviously have done this on two platforms, can you see where
the
two versions first differ?

Do the cookiejars end up the same when saved?

-- 
    Daniel Stenberg -- curl groks URLs -- http://curl.haxx.se/
Received on 2002-04-17