Hi all,

I have a mix of Apache::ASP code and mod_perl code. Specifically, I use
Apache::ASP to do the bulk of my site's dynamic pages, plus I have written
some mod_perl handlers where I've needed to alter server behavior. One of
these mod_perl handlers does authorization, which is germane to this note
on managing cookies.

I needed to access the cookies created by Apache::ASP code from inside
my mod_perl handler. I typically use the CGI::Cookie module in mod_perl
to manage cookies. Alas, the way CGI::Cookie does its parse of the cookie
is not compatible with how Apache::ASP stored the cookie payload; the
parsing gets hung up on the '=' character in the payload.

So for now I copied into my mod_perl module the following subroutines
from Apache::ASP (from package Apache::ASP::Request):  Unescape(),
ParseParams(), and a snippet from new() that gets cookies. I had to
tweek these just a little bit to interface with my code. This works.

However, I don't think this is a good long term solution. I ought to
be able to access cookies the "Apache::ASP way" from mod_perl. It woiuld
be better whenever I do version upgrades of Apache::ASP. I would really
just like to be able to say in my mod_perl module:

  package MyApacheAccessHandler;

  use Apache::ASP;

  ## code code code
  ## code code code

  sub _check_for_ticket {
    my $r = shift;
    my $cookie_name = shift;

    ## get cookies via Apache::ASP API
    my $c = Apache::ASP::Request::ReadCookies($r);  ## or something...

        ## (ignore my 70x code nomenclature....)
    return (701, 'no cookies or cookie headers') unless $c;
    return (703, 'user has no ticket' ) unless $c->{$cookie_name};

        ## found it
    return (0, $c->{$cookie_name});
}


I can work on a patch that meshes well with mod_perl if there's anyone
else out these in this boat too...

Comments?

Broc

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to