in reply to mod_perl, Apache access_log, and CGI::Session (Logging Authenticated Username)

It would appear that the user method in Apache2::RequestRec under mod_perl2 allows you to set, as well as retrieve, the user ID. See the docs.

Actually, I'm glad you suggested that because it gives me an idea - I have a situation where I'd really love to use a PerlAuthzHandler but it doesn't work because the user ID is sent through a custom header field or cookie instead of an actual HTTP user.

Replies are listed 'Best First'.
Re^2: mod_perl, Apache access_log, and CGI::Session (Logging Authenticated Username)
by monarch (Priest) on Nov 09, 2005 at 05:42 UTC
    Apparently I can do it with Apache 1 as well.. Running httpd -v gives me:
    Server version: Apache/1.3.27 (Unix) (Red-Hat/Linux) Server built: Mar 15 2005 14:49:39

    The final handler I used (not the one given for the thread question) was the following for handling CGI scripts:

    <Perl> { package SessionLogAndHandle; use CGI::Session; use Apache::PerlRun; sub handler { my ( $r ) = @_; { my $s = CGI::Session->new(); my $authuser = $s->param( 'AUTHUSER' ); $r->user( $authuser ) if ( $authuser ); } # I want $s to go out of scope return( Apache::PerlRun->handler( $r ) ); } } </Perl> <Directory "/var/www/myproject/bin"> Options +ExecCGI SetHandler perl-script PerlHandler SessionLogAndHandle Allow from all </Directory>

    Update: removed superfluous session flush because I wasn't modifying the session.