Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask

Re^2: Mod_perl Handler

by Anonymous Monk
on Jul 17, 2008 at 16:20 UTC ( [id://698348]=note: print w/replies, xml ) Need Help??

in reply to Re: Mod_perl Handler
in thread Mod_perl Handler

Yes , but it doest pass to next handler

I have python cgi scripts along with mod_perl handler

after mod_perl handler the control is not passed to mod_cgi

any help?

Replies are listed 'Best First'.
Re^3: Mod_perl Handler
by clinton (Priest) on Jul 17, 2008 at 16:26 UTC

    You haven't provided any details about how you've configured Apache, but I'm guessing that you're trying to use both mod_cgi and mod_perl for the PerlResponseHandler, and I don't think that will work.

    If you're using the mod_perl handler to check the cookie, why not put it into a separate phase, such as PerlAccessHandler. See the HTTP Handler docs for details.

      Alias /borg /home/vijay/src/atd/borg/html <Directory /home/vijay/src/atd/borg/html> Options +Includes +Indexes +FollowSymlinks XBitHack on Order allow,deny Allow from all DirectoryIndex index.htm index.html index.php </Directory> <Directory "/home/vijay/src/atd/borg/html/cgi-bin"> Options +ExecCGI +Includes +Indexes +FollowSymlinks XBitHack on Order allow,deny SetHandler cgi-script Allow from all </Directory> PerlModule Apache::GateKeeper <Location /borg> SetHandler perl-script PerlAccessHandler Apache::GateKeeper </Location> sub handler { my $r = shift; $r->subprocess_env(); my %cookies = fetch CGI::Cookie; loger(\%cookies); if (!defined($cookies{'U'})) { $r->headers_out->set( Location => ' +gin.php'); return Apache2::Const::REDIRECT; } return Apache2::Const::DECLINED; }
      Still cgi-scripts are not being executed , please help me

        You're mixing <Directory> and <Location> directives, and according to the docs, your <Location /borg> configuration prevents access to any URL-path that begins in /borg

        Also, It is important to never use <Location> when trying to restrict access to objects in the filesystem. This is because many different webspace locations (URLs) could map to the same filesystem location, allowing your restrictions to be circumvented.

        However, you can use mod_perl handlers in <Directory> configurations. If you look at the docs for PerlAccessHandler, you will see that it specifies a configuration scope of DIR which means that it can be used in <Location><Directory> and <File> directives.

        That said, i can't think of a way to call both Perl and Python CGIs from within the the same <Directory> config section, if you intend using SetHandler perl-script, because you require two SetHandler directives in the same space...

        So what can you do? Hmmm... good question. All you want to do is:

        • check a cookie using Perl and either:
          • redirect the user to login, or
          • run a python script

        So why don't have you have one call the other. Either have the python script execute the Perl script, or have the Perl script call the python script, but you'll have to be very careful about what scripts you allow it to call. For instance, if you're careless, and you just allow the user to pass in their own path without checking what it contains, then a path like /borg/../../../rm%20-Rf could be disastrous...

        Good luck!

        Good luck. I almost exclusively use mod_perl handlers, so I may be missing a trick.


Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://698348]
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (4)
As of 2024-07-25 18:42 GMT
Find Nodes?
    Voting Booth?

    No recent polls found

    erzuuli‥ 🛈The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.