[Nginx] perl module get an empty body

darkweaver871 nginx-forum at nginx.us
Fri Aug 10 14:12:56 UTC 2012


OK, so is this better ?

#!/usr/bin/perl

package switcher_test;
use nginx;

use Sys::Syslog;

my $facility = 'local2';

sub handler {
        my $r = shift;

        return $r->has_request_body(\& test);

}

sub test {
        my $r = shift;
        if ($r->request_body =~ /.*test.*/) { return 3 };
        openlog('switcher', 'ndelay', $facility);
        syslog(LOG_DEBUG, 'request_body: '.$r->request_body);
        syslog(LOG_DEBUG, 'request_body_file: '.$r->request_body_file);
        return 4;
}

1;
__END__


It still doesn't work this way.

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,229560,229574#msg-229574



More information about the nginx mailing list