On Wed, 19 Feb 2003, Nick Tonkin wrote:

>
> Hi all,
>
> Cookies driving me nuts as usual but I think the problem appears to be
> related to which handler phase we are in.
>
> Basically, the same call to read the cookies works in the PerlHandler but
> not in the PerlAccessHandler.

Responding to my own post here, to keep the archive complete. (That's the
only reason, since there doesn;t seem to be anyone else using cookies for
auth stuff in mp2 ...)

Testing has shown that the first diagnosis was correct. Stas tracked it
down to %ENV not getting populated prior to the Response phase. He is
working on a fix.

Meanwhile I'm getting around the problem by subclassing CGI::Cookie (which
we are using since Apache::Request is not ported to mp2 yet) thusly:

package WM::Auth::Cookie;

use strict;
use warnings;
use CGI::Cookie;

@WM::Auth::Cookie::ISA = qw/CGI::Cookie/;

sub fetch {
    my $class = shift;
    my $r = shift;
    my $raw_cookie = $r->headers_in->{'Cookie'};
    return () unless $raw_cookie;
    return $class->parse($raw_cookie);
}

1;

the only difference in API being that one must replace

my $cookie = CGI::Cookie->fetch();

with

my $cookie = WM::Auth::Cookie->fetch($r);

Looking forward to the proper fix though.


- nick

-- 

~~~~~~~~~~~~~~~~~~~~
Nick Tonkin   {|8^)>

Reply via email to