[prev in list] [next in list] [prev in thread] [next in thread] 

List:       apache-modperl
Subject:    Re: PerlAccessHandler for POST access
From:       "Edward J. Sabol" <edwardjsabol () gmail ! com>
Date:       2022-08-04 10:20:05
Message-ID: 2DBF858C-BFCC-48CB-9FB1-0EF11B08AD5B () gmail ! com
[Download RAW message or body]

On Aug 4, 2022, at 5:09 AM, pengyh <pengyh@mail.de> wrote:
> > LoadModule apreq_module modules/mod_apreq2.so
> > in your httpd.conf?
> 
> yes. as you see:
> lrwxrwxrwx 1 root root 27 Aug  4 14:00 perl.load -> ../mods-available/perl.load
> lrwxrwxrwx 1 root root 29 Aug  4 14:01 apreq2.load -> ../mods-available/apreq2.load
> 
> 
> > Have you tried it with mpm_prefork?
> 
> the development environment is mpm_prefork.
> 
> > What version of Apache and mod_perl are you using exactly?
> 
> Apache/2.4.41 (Ubuntu) mod_apreq2-20101207/2.8.0 mod_perl/2.0.11 Perl/v5.30.0 \
> configured 
> 
> ubuntu 20.04 x64 OS.

I presume you installed these things using apt-get? Is Apache2::Request version 2.16?

I apologize in advance if the following suggestions are obvious things you've already \
tried:

Could you try changing the handler to log or display the values of $ts and $key? What \
do they contain if anything? I'd log or display $r->as_string as well.

Also, try putting an eval { } block around the code inside your handler and then log \
or display the value of $@.

Something like this:

package MyApacheAccessHandler;

use strict;
use Apache2::RequestRec ();
use Apache2::RequestIO ();
use Apache2::Connection ();
use APR::Table ();
use Apache2::Const -compile => qw(OK FORBIDDEN);
use Apache2::ServerUtil ();
use Apache2::Log ();
use Apache2::Request;
use Digest::MD5 qw(md5_hex);

sub handler {

   my $r = shift;
   my $s = Apache2::ServerUtil->server;

   eval {
       $s->log_error("r = ", $r->as_string);

       my $req = Apache2::Request->new($r);
       my $ts = $req->param("timestamp");
       my $key = $req->param("authkey");
       my $digest = md5_hex($ts);

       $s->log_error("ts = ", $ts);
       $s->log_error("key = ", $key);
       $s->log_error("digest = ", $digest);
   };
   if ($@) {
       $s->log_error("exception: ", $@);
   }

   return $key eq $digest ? Apache2::Const::OK : Apache2::Const::FORBIDDEN;
}

After testing the above, what's does the error_log file show?

Later,
Ed


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic