cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: Cookie ignored !(?)

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Tue, 5 Aug 2003 00:32:04 +0200 (CEST)

On Mon, 4 Aug 2003, Jan Sundin wrote:

> Im having trouble with cookies in Curl (version curl-7.10.6, win32,
> openssl-0.9.7a ).
>
> For the URL im requesting the server sets two cookies and sends a
> redirect/location-header. Curl then issues a GET to the correct URL but does
> _not_ set any cookie-headers to send the cookies back to the server! Why
> isn't the cookies sent back to the server?

Uh. Because it thinks the received cookie isn't a valid one... :-)

> My command line:
> curl -c cookies.out -b cookies.in -k --trace-ascii out.txt -i -L -v
> https://test.NOT_DISCLOSED.se/ICSLogin/auth-up -d paramA -d paramB
>
> (Note that the cookie-engine is enabled with -b). After executing the
> command the file cookies.out is empty. Below is a trace from the session.
>
> Why is the cookie "ignored" by curl?

The reason is quite simple: it does not meet the criterias made up in the
netscape cookie spec and that I made curl obey not too long ago. I realize now
that perhaps browsers don't do this careful check to skip out on domain names
with too few dots...

Anyway, please try the following patch and let me know if this fixes your
problem (it did when I added your case to a test case and run it):

diff -u -r1.45 cookie.c
--- lib/cookie.c 26 Jun 2003 06:50:32 -0000 1.45
+++ lib/cookie.c 4 Aug 2003 22:31:18 -0000
@@ -234,7 +234,7 @@
                 break;
               }
             }
- if(dotcount < 3) {
+ if(dotcount < 2) {
               /* Received and skipped a cookie with a domain using too few
                  dots. */
               badcookie=TRUE; /* mark this as a bad cookie */

-- 
 Daniel Stenberg -- curl: been grokking URLs since 1998
-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
Received on 2003-08-05