All,

ok, I think I nailed down the problem...

given the uri translation (by either mod_rewrite or PerlTransHandler)

/  -->  /perl-bin/test.cgi

the code below will, by default 
parse cookies whose path matches /
but bake cookies whose path matches /perl-bin

adding
-path => "/",
to the new cookie kinda solves my problem, but I am wondering if this
behavior is appropriate?

just curious...

--Geoff

## test.cgi code snip...

my %cookies = Apache::Cookie->new($r)->parse;

foreach (sort keys %cookies) {
  my $cookie = $cookies{$_};
  warn "$cookie->name, $cookie->value;";
}

my $cookie = Apache::Cookie->new($r,
                                 -name    =>  'foo',
                                 -value   =>  'bar',
                                 -expires =>  '+10y'
                                 );
$cookie->bake;

## end

> -----Original Message-----
> From: Geoffrey Young [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, January 20, 2000 12:28 PM
> To: '[EMAIL PROTECTED]'
> Subject: RE: mod_rewrite and Apache::Cookie
> 
> 
> for anyone interested...
> 
> I wrote a PerlTransHandler and removed mod_rewrite and am 
> seeing the same
> problem as outlined below...
> 
> can anyone verify this?
> 
> --Geoff
> 
> > -----Original Message-----
> > From: Geoffrey Young 
> > Sent: Wednesday, January 19, 2000 9:27 AM
> > To: '[EMAIL PROTECTED]'
> > Subject: mod_rewrite and Apache::Cookie
> > 
> > 
> > hi all..
> > 
> > I've noticed that using mod_rewrite with Apache::Cookie 
> > exhibits odd behavior...
> > 
> > scenario:
> >     foo.cgi uses Apache::Cookie to set a cookie
> >     mod_rewite writes all requests for index.html to 
> > /perl-bin/foo.cgi
> > 
> > problem:
> >     access to /perl-bin/foo.cgi sets the cookie properly
> >     access to /  or index.html runs foo.cgi, and attempts 
> > to set the cookie, but $cookie->bake issues the generic:
> > Warning: something's wrong at 
> > /usr/local/apache/perl-bin/foo.cgi line 34.
> > 
> > While I know I can use a PerlTransHandler here (and probably 
> > will now), does anyone have any ideas about this behavior?
> > 
> > In the meanwhile, if I find out anything more while 
> > investigating, I'll post it...
> > 
> > --Geoff
> > 
> 

Reply via email to