httpd-apreq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrea Palmieri" <palmi...@eng.it>
Subject Apache::Cookie baking bug
Date Tue, 15 Mar 2005 16:47:17 GMT
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
}
Mime
View raw message