You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Nenad Steric <ne...@teleweb.at> on 2001/06/16 02:00:08 UTC

Re: Sending Cookies from Access-Handler - Update

I was wrong, there is no cookie being set at all.

So, what happens is that the handler gets called 
i get an entry in the error_log like
"setting cookie Ticket=ID&1; ... expires=Sun, 15-Jul-2001 ..."
and No Cookie being sent to the browser.

Is it possible to send cookies from the Accesshandler ? or am i wasting my time ?
Should i use push_handlers and use another phase of the request ?

which my modperl doesn't like, i built it with "EVERYTHING=1" but it doesn't want to call 
other handlers than the AccessHandler .. another Puzzle it seems.


Nenad wrote:
> package Apache::PermanentTicketRenewer
use etc. etc.
> my $Counter;
> sub handler {
>     my $r = shift; 
>     $Counter += 1;
>     my $cookie = CGI::Cookie->new(-name => 'Ticket',
>                                   -path => '/',
>                                   -domain => '.my.com',
>                                   -expires => '+1M',
>                                   -value => { 'ID' => $Counter }
>                                  );
> 
>     $r->warn('setting cookie ',$cookie);    # this shows up in the error_log
>     $r->headers_out->add("Set-Cookie" => $cookie);
> i also tried
>     $r->err_header_out("Set-Cookie" => $cookie);
> and
>     $r->cgi_header_out("Set-Cookie" => $cookie);
>     return OK;
> }
> 
> and in httpd.conf
> <Location /my_protected >
>  PerlSendHeader On
>  PerlAccessHandler      Apache::TicketAccess
>  #PerlAuthzHandler      Apache::TicketAccess
> ...
> </Location>
> 
> And it doesn't work !
> The Browser does not set the new cookie , only the first ever sent cookie is set.
> Whats wrong with this ?
> As you can see i also tried to use the AutzHandler, but somehow this does not get called at all.
>

Re: Sending Cookies from Access-Handler - Fixed

Posted by Rodney Broom <rb...@home.com>.
Something else, I haven't used CGI's cookie handling, but I have used
Apache::Cookie. I know that this can be done from an AuthenHandler and from
a TransHandler.

---
Rodney Broom




Re: Sending Cookies from Access-Handler - Fixed

Posted by Nenad Steric <ne...@teleweb.at>.
Ok, 
i think i should really go to sleep now ...

It was using the wrong domain !
forgot to tell apache that it is called "www.my.com"
as i was sending cookies for ".my.com" ...

strangely under win32 this didn't work even with the right domain...

good night,

Nenad


> 
> Ok,
> i tried the push_handlers with PerlFixupHandler,
> as before this gets called also ,
> i get an entry in my error_log (because i use $r->warn to log)
> and again no cookie is being sent ...
> 
> For the record : i am using apache 1.3.20 and modperl 1.25
> 
> Do i have to do a redirect or something similar so that the browser
> sets the cookie ?
> Or do i have problems with the basic configuration of apache ?
> 
> Nenad Steric wrote:
> >
> > I was wrong, there is no cookie being set at all.
> >
> > So, what happens is that the handler gets called
> > i get an entry in the error_log like
> > "setting cookie Ticket=ID&1; ... expires=Sun, 15-Jul-2001 ..."
> > and No Cookie being sent to the browser.
> >
> > Is it possible to send cookies from the Accesshandler ? or am i wasting my time ?
> > Should i use push_handlers and use another phase of the request ?
> >

Re: Sending Cookies from Access-Handler - Update 2

Posted by Nenad Steric <ne...@teleweb.at>.
Ok,
i tried the push_handlers with PerlFixupHandler,
as before this gets called also , 
i get an entry in my error_log (because i use $r->warn to log)
and again no cookie is being sent ...

For the record : i am using apache 1.3.20 and modperl 1.25

Do i have to do a redirect or something similar so that the browser
sets the cookie ?
Or do i have problems with the basic configuration of apache ?


Nenad Steric wrote:
> 
> I was wrong, there is no cookie being set at all.
> 
> So, what happens is that the handler gets called
> i get an entry in the error_log like
> "setting cookie Ticket=ID&1; ... expires=Sun, 15-Jul-2001 ..."
> and No Cookie being sent to the browser.
> 
> Is it possible to send cookies from the Accesshandler ? or am i wasting my time ?
> Should i use push_handlers and use another phase of the request ?
>