Mercurial > hg > nginx
annotate auto/lib/perl/conf @ 9300:5be23505292b default tip
SSI: fixed incorrect or duplicate stub output.
Following 3518:eb3aaf8bd2a9 (0.8.37), r->request_output is only set
if there are data in the first buffer sent in the subrequest. As a
result, following the change mentioned this flag cannot be used to
prevent duplicate ngx_http_ssi_stub_output() calls, since it is not
set if there was already some output, but the first buffer was empty.
Still, when there are multiple subrequests, even an empty subrequest
response might be delayed by the postpone filter, leading to a second
call of ngx_http_ssi_stub_output() during finalization from
ngx_http_writer() the subreqest buffers are released by the postpone
filter. Since r->request_output is not set after the first call, this
resulted in duplicate stub output.
Additionally, checking only the first buffer might be wrong in some
unusual cases. For example, the first buffer might be empty if
$r->flush() is called before printing any data in the embedded Perl
module.
Depending on the postpone_output value and corresponding sizes, this
issue can result in either duplicate or unexpected stub output, or
"zero size buf in writer" alerts.
Following 8124:f5515e727656 (1.23.4), it became slightly easier to
reproduce the issue, as empty static files and empty cache items now
result in a response with an empty buffer. Before the change, an empty
proxied response can be used to reproduce the issue.
Fix is check all buffers and set r->request_output if any non-empty
buffers are sent. This ensures that all unusual cases of non-empty
responses are covered, and also that r->request_output will be set
after the first stub output, preventing duplicate output.
Reported by Jan Gassen.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Thu, 04 Jul 2024 17:41:28 +0300 |
parents | 30b6f1ff192b |
children |
rev | line source |
---|---|
599 | 1 |
2 # Copyright (C) Igor Sysoev | |
4412 | 3 # Copyright (C) Nginx, Inc. |
599 | 4 |
5 | |
6 echo "checking for perl" | |
7 | |
8 | |
9 NGX_PERL_VER=`$NGX_PERL -v 2>&1 | grep '^This is perl' 2>&1 \ | |
10 | sed -e 's/^This is perl, \(.*\)/\1/'` | |
11 | |
12 if test -n "$NGX_PERL_VER"; then | |
13 echo " + perl version: $NGX_PERL_VER" | |
14 | |
6821
30b6f1ff192b
Perl: removed special environment handling for the perl module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6700
diff
changeset
|
15 if [ "`$NGX_PERL -e 'use 5.008006; print "OK"'`" != "OK" ]; then |
599 | 16 echo |
6821
30b6f1ff192b
Perl: removed special environment handling for the perl module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6700
diff
changeset
|
17 echo "$0: error: perl 5.8.6 or higher is required" |
599 | 18 echo |
19 | |
20 exit 1; | |
21 fi | |
22 | |
4866
fac1cc762969
Configure: additional test for ExtUtils::Embed perl module presence.
Andrey Belov <defan@nginx.com>
parents:
4412
diff
changeset
|
23 if [ "`$NGX_PERL -MExtUtils::Embed -e 'print "OK"'`" != "OK" ]; then |
fac1cc762969
Configure: additional test for ExtUtils::Embed perl module presence.
Andrey Belov <defan@nginx.com>
parents:
4412
diff
changeset
|
24 echo |
fac1cc762969
Configure: additional test for ExtUtils::Embed perl module presence.
Andrey Belov <defan@nginx.com>
parents:
4412
diff
changeset
|
25 echo "$0: error: perl module ExtUtils::Embed is required" |
fac1cc762969
Configure: additional test for ExtUtils::Embed perl module presence.
Andrey Belov <defan@nginx.com>
parents:
4412
diff
changeset
|
26 echo |
fac1cc762969
Configure: additional test for ExtUtils::Embed perl module presence.
Andrey Belov <defan@nginx.com>
parents:
4412
diff
changeset
|
27 |
fac1cc762969
Configure: additional test for ExtUtils::Embed perl module presence.
Andrey Belov <defan@nginx.com>
parents:
4412
diff
changeset
|
28 exit 1; |
fac1cc762969
Configure: additional test for ExtUtils::Embed perl module presence.
Andrey Belov <defan@nginx.com>
parents:
4412
diff
changeset
|
29 fi |
fac1cc762969
Configure: additional test for ExtUtils::Embed perl module presence.
Andrey Belov <defan@nginx.com>
parents:
4412
diff
changeset
|
30 |
6700
0d2956dfc4e6
Perl: pass additional linker options to perl module.
Konstantin Pavlov <thresh@nginx.com>
parents:
6419
diff
changeset
|
31 NGX_PM_CFLAGS=`$NGX_PERL -MExtUtils::Embed -e ccopts` |
0d2956dfc4e6
Perl: pass additional linker options to perl module.
Konstantin Pavlov <thresh@nginx.com>
parents:
6419
diff
changeset
|
32 NGX_PM_LDFLAGS=`$NGX_PERL -MConfig -e 'print $Config{lddlflags}'` |
0d2956dfc4e6
Perl: pass additional linker options to perl module.
Konstantin Pavlov <thresh@nginx.com>
parents:
6419
diff
changeset
|
33 |
681 | 34 NGX_PERL_CFLAGS="$CFLAGS `$NGX_PERL -MExtUtils::Embed -e ccopts`" |
35 | |
36 # gcc 4.1/4.2 warn about unused values in pTHX_ | |
37 NGX_PERL_CFLAGS=`echo $NGX_PERL_CFLAGS \ | |
38 | sed -e 's/-Wunused-value/-Wno-unused-value/'` | |
39 # icc8 warns 'declaration hides parameter "my_perl"' in ENTER and LEAVE | |
40 NGX_PERL_CFLAGS=`echo $NGX_PERL_CFLAGS \ | |
41 | sed -e 's/-wd171/-wd171 -wd1599/'` | |
42 | |
599 | 43 ngx_perl_ldopts=`$NGX_PERL -MExtUtils::Embed -e ldopts` |
44 | |
5145
f6777aef5b2f
Configure: fixed perl module make rules.
Ruslan Ermilov <ru@nginx.com>
parents:
4866
diff
changeset
|
45 ngx_perl_dlext=`$NGX_PERL -MConfig -e 'print $Config{dlext}'` |
5743
dde2ae4701e1
Configure: restored "nginx/" missed in 6e4bb1d6679d.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5739
diff
changeset
|
46 ngx_perl_libdir="src/http/modules/perl/blib/arch/auto" |
dde2ae4701e1
Configure: restored "nginx/" missed in 6e4bb1d6679d.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5739
diff
changeset
|
47 ngx_perl_module="$ngx_perl_libdir/nginx/nginx.$ngx_perl_dlext" |
5145
f6777aef5b2f
Configure: fixed perl module make rules.
Ruslan Ermilov <ru@nginx.com>
parents:
4866
diff
changeset
|
48 |
599 | 49 if $NGX_PERL -V:usemultiplicity | grep define > /dev/null; then |
50 have=NGX_HAVE_PERL_MULTIPLICITY . auto/have | |
51 echo " + perl interpreter multiplicity found" | |
52 fi | |
53 | |
872
1c4a5b3f9110
Axe several perl interpreter instances: they may be useful in currently
Igor Sysoev <igor@sysoev.ru>
parents:
681
diff
changeset
|
54 if $NGX_PERL -V:useithreads | grep undef > /dev/null; then |
599 | 55 # FreeBSD port wants to link with -pthread non-threaded perl |
56 ngx_perl_ldopts=`echo $ngx_perl_ldopts | sed 's/ -pthread//'` | |
57 fi | |
58 | |
5722
baf2816d556d
Configure: workaround for system perl on OS X (ticket #576).
Maxim Dounin <mdounin@mdounin.ru>
parents:
5145
diff
changeset
|
59 if [ "$NGX_SYSTEM" = "Darwin" ]; then |
baf2816d556d
Configure: workaround for system perl on OS X (ticket #576).
Maxim Dounin <mdounin@mdounin.ru>
parents:
5145
diff
changeset
|
60 # OS X system perl wants to link universal binaries |
5739 | 61 ngx_perl_ldopts=`echo $ngx_perl_ldopts \ |
6308
7e241b36819d
Configure: improved workaround for system perl on OS X.
Ruslan Ermilov <ru@nginx.com>
parents:
5743
diff
changeset
|
62 | sed -e 's/-arch i386//' -e 's/-arch x86_64//'` |
5722
baf2816d556d
Configure: workaround for system perl on OS X (ticket #576).
Maxim Dounin <mdounin@mdounin.ru>
parents:
5145
diff
changeset
|
63 fi |
baf2816d556d
Configure: workaround for system perl on OS X (ticket #576).
Maxim Dounin <mdounin@mdounin.ru>
parents:
5145
diff
changeset
|
64 |
6419 | 65 if [ $USE_PERL = YES ]; then |
66 CORE_LINK="$CORE_LINK $ngx_perl_ldopts" | |
67 fi | |
68 | |
69 NGX_LIB_PERL="$ngx_perl_ldopts" | |
599 | 70 |
71 if test -n "$NGX_PERL_MODULES"; then | |
72 have=NGX_PERL_MODULES value="(u_char *) \"$NGX_PERL_MODULES\"" | |
73 . auto/define | |
950
9581fba9ea12
fix for nginx.pm default installation
Igor Sysoev <igor@sysoev.ru>
parents:
872
diff
changeset
|
74 NGX_PERL_MODULES_MAN=$NGX_PERL_MODULES/man3 |
599 | 75 fi |
76 | |
77 else | |
78 echo | |
6821
30b6f1ff192b
Perl: removed special environment handling for the perl module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6700
diff
changeset
|
79 echo "$0: error: perl 5.8.6 or higher is required" |
599 | 80 echo |
81 | |
82 exit 1; | |
83 fi |