cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: Bug in cookie parsing?

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Mon, 25 Sep 2000 12:33:10 +0200 (MET DST)

On Sat, 23 Sep 2000, Dirk Kruschewski wrote:

> The problem is that in cookie.c the lineptr is divided by semicolons and
> the part in the left of the semicolon is parsed. This works only
> correctly if the last character of the cookie line is a semicolon. IMHO
> it is not necessary that the cookie ends with a semicolon. Please correct
> me, if I am wrong. (In my example the server sends only "Set-Cookie:
> ID=xyz".)

Cookies aren't following standards. Cookies are often generated by common
scripts, and thus they are sent as the authors of those scripts think they
should be sent.

Besides, the RFC 2109 that defines how cookies should be sent have never been
followed.

I agree with you that curl should not depend on ;-separation.

> For me I made a quick and dirty hack in function cookie_init. Right after
> the comment "This is a cookie line, get it!" I add a semicolon to the
> variable line. But I do not know in the moment, if this does not produce
> problems in other scenarios.

I'd rather do a patch like the one attached to this mail. I'll appriciate
feedback on the success or failure of this patch.

-- 
  Daniel Stenberg -- curl project maintainer -- http://curl.haxx.se/

Received on 2000-09-25