cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Netscape cookie file

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Wed, 23 May 2001 08:09:34 +0200 (MET DST)

On Wed, 23 May 2001, Andrés García wrote:

> I have noticed that, sometimes, netscape and mozilla don't save the path
> of a cookie, for example, it happens to me in www.cajastur.es.

Hm. And you're sure that isn't just a bug in your browser version?

> As the path is missing, libcurl discards the cookie. This seems more
> netscape's problem than libcurl's, but it wouldn't be too hard to support
> it doing something like:
>
> --- cookie.c Wed May 23 01:18:52 2001
> +++ curl-7.7.4-pre2/lib/cookie.c Fri Jan 5 11:11:42 2001
> @@ -235,8 +235,3 @@
> case 2:
> - if ((strncmp("TRUE",ptr,4))&&(strncmp("FALSE",ptr,5))) {
> - co->path = strdup(ptr);
> - } else {
> - co->path = "/";
> - fields++;
> - }
> + co->path = strdup(ptr);
> break;

I think you'd want the section to look like:

      case 2:
        if ((strncmp("TRUE",ptr,4))&&(strncmp("FALSE",ptr,5))) {
          co->path = strdup(ptr);
          break;
        }
        co->path = strdup("/");
        fields++;
        /* FALLTHROUGH */

      case 3:

with a strdup() of the static string, and with a fall through to the next
case if we can't find the path, so that the next field is still taken care of
properly. Isn't that correct?

> It works but it feels like a kludge.

Big-time kludge indeed...

-- 
     Daniel Stenberg -- curl dude -- http://curl.haxx.se/
_______________________________________________
Curl-library mailing list
Curl-library_at_lists.sourceforge.net
http://lists.sourceforge.net/lists/listinfo/curl-library
Received on 2001-05-23