If I do this:

Apache::Cookie->new( $r,
                     -name => 'foo',
                     -value => { will_break => '', completely_borked => 1 } )->bake;

and then I later try to read the cookie in and do this:

my %c = Apache::Cookie->fetch;
my %cookie = $c{foo}->value;

print $cookie{will_break};

It will print 'completely_borked'!

The cookie's value looks something like this when sent to the browser:

will_break&&completely_borked&1


The problem is here in apache_cookie.c

        while (*pair && (val = ap_getword(r->pool, &pair, '&'))) {
            ap_unescape_url((char *)val);
            ApacheCookieAdd(c, val);
        }

Here's a line from the ap_getword docs.

  Copies everything from line up to stop to a new string. line is updated
  to point to the first character after stop. Multiple occurrences of stop
  are skipped if present.

It's that multiple occurrences are skipped bit that's causing the trouble.

I tried to fix it but I am a C gimp and don't know WTF I am doing.


-dave

/*==================
www.urth.org
We await the New Sun
==================*/


Reply via email to