You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Andrea Palmieri <pa...@eng.it> on 2005/03/15 17:47:17 UTC

Apache::Cookie baking bug

I read in some previous message that Apache::Cookie->bake is buggy so used   $r->headers_out->add('Set-Cookie'=>$cookie);
to send a cookie to a browser but..no way the browser do not receive any cookie !!!
did I miss something ? Below I enclose my code fragment. 
Any help is apreciated
Thanks
Andrea

Versions:
   apache 2.0.53
   mod_perl 2.0.0 RC4
   libapreq2 2.04-dev
   perl 5.8.0

My httpd.conf:
    <Location /hello3>
 SetHandler perl-script
 PerlAuthzHandler Apache::Hello3 
 AuthType Basic
 AuthName "Inserire la password"
  AuthUserFile "/usr/local/apache2/bin/pwd"
  Require valid-user
</Location>

My handler:


sub handler {
   my $r = shift;

# fetch  cookies
 my %cookies= $Apache::Request::VERSION >= 2 ? Apache::Cookie->fetch($r) : Apache::Cookie->fetch;

if (defined %cookies){
  my $cookie = $cookies{'ApacheSession'}; 
         $r->log_error('cookie found: ',$cookie->as_string());                       
 }
 else{
      $r->log_error('cookie not found');
      my $cookie = Apache::Cookie->new($r,
                                -name    =>  'ApacheSession', 
                                -value   =>  123456,
                                -path    =>  '/',
                               );
      $r->headers_out->add('Set-Cookie'=>$cookie);
   } 

  $r->internal_redirect('/reload.htm');
    return Apache:OK
}

Re: Apache::Cookie baking bug

Posted by Joe Schaefer <jo...@sunstarsys.com>.
"Andrea Palmieri" <pa...@eng.it> writes:

> I read in some previous message that Apache::Cookie->bake is buggy so used
> $r->headers_out->add('Set-Cookie'=>$cookie);

Try err_headers_out; I'm not the headers_out table
is copied to an internal redirect.

-- 
Joe Schaefer


Re: Apache::Cookie baking bug

Posted by Joe Schaefer <jo...@sunstarsys.com>.
"Andrea Palmieri" <pa...@eng.it> writes:

> I read in some previous message that Apache::Cookie->bake is buggy so used
> $r->headers_out->add('Set-Cookie'=>$cookie);

Try err_headers_out; I'm not the headers_out table
is copied to an internal redirect.

-- 
Joe Schaefer