Hi Kropotkin,

kropotkin wrote:
> Hi I am using the following: Apache 2.0.52. mod_perl 2.0.3 and Mason 1.69.I
> am trying to set a cookie and do a full http re-direct, in the same breath
> (so to speak). I have this:$r->headers_out->set('Set-Cookie: ' => 
> $testCookie);$m->redirect($location);The Set-Cookie header is not sent.If I
> do this:$r->headers_out->set('Set-Cookie' => 
> $testCookie);$r->headers_out->set('Location' =>
> $location);$m->abort(301);the same problem.What I want to do is send a set
> cookie header and do a redirect. At $location I then check for the cookie
> and I can see if the client is accepting cookies. But the sending of the
> redirect (especially the abort) stops Apache sening the Set-Cookie header.
> Any help gratefully appreciated..Kropotkin
>   

I also do redirects and set cookies, but i do it differently.  Does 
altering the following fit your needs?

-----
use Apache2::Request ();
use Apache2::RequestRec ();
use Apache2::Const -compile => qw(OK);

my $cookie = Apache2::Cookie->new ($r,
                             -name    =>  'testcookie',
                             -value   =>  'foo',
                             -expires =>  '+1h',
                             -path    =>  '/',
                             -domain  =>  'your.domain.here'
                            );

$cookie -> bake ($r);


$m -> redirect ($somewhere);
-----

You might want to reduce the arguments to "new" to the minimum as a 
starting point...i.e., just name and value.

Good luck!

Ray

PS:  This is not exactly what I have...I cut and pasted from various 
parts in my code...



-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Mason-users mailing list
Mason-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mason-users

Reply via email to