]> git.kaiwu.me - nginx.git/commit
Perl: reworked perl module to pass ctx instead of request.
authorMaxim Dounin <mdounin@mdounin.ru>
Fri, 12 Jul 2019 08:29:22 +0000 (11:29 +0300)
committerMaxim Dounin <mdounin@mdounin.ru>
Fri, 12 Jul 2019 08:29:22 +0000 (11:29 +0300)
commiteae5e4dd01dfaff9d15c3dd7818f082e2995cc74
treea443f9c4a055c38b4155bc9376ee30c4b9578fb3
parent60e7480533480b6340cae596118aa0ac72c0fce9
Perl: reworked perl module to pass ctx instead of request.

This ensures that correct ctx is always available, including after
filter finalization.  In particular, this fixes a segmentation fault
with the following configuration:

    location / {
        image_filter test;

        perl 'sub {
            my $r = shift;
            $r->send_http_header();
            $r->print("foo\n");
            $r->print("bar\n");
        }';
    }

This also seems to be the only way to correctly handle filter finalization
in various complex cases, for example, when embedded perl is used both
in the original handler and in an error page called after filter
finalization.
src/http/modules/perl/nginx.xs
src/http/modules/perl/ngx_http_perl_module.c
src/http/modules/perl/ngx_http_perl_module.h