Mercurial > hg > nginx
annotate auto/cc/icc @ 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 | 9eefb38f0005 |
children |
rev | line source |
---|---|
455 | 1 |
2 # Copyright (C) Igor Sysoev | |
4412 | 3 # Copyright (C) Nginx, Inc. |
455 | 4 |
5 | |
4395
7ee8e11e17bb
Some questionable optomizations flags for icc were removed
Maxim Konovalov <maxim@nginx.com>
parents:
1171
diff
changeset
|
6 # Intel C++ compiler 7.1, 8.0, 8.1, 9.0, 11.1 |
455 | 7 |
521 | 8 NGX_ICC_VER=`$CC -V 2>&1 | grep 'Version' 2>&1 \ |
1170
5e878722ad57
remove trailing space in icc version
Igor Sysoev <igor@sysoev.ru>
parents:
681
diff
changeset
|
9 | sed -e 's/^.* Version \([^ ]*\) *Build.*$/\1/'` |
521 | 10 |
11 echo " + icc version: $NGX_ICC_VER" | |
12 | |
557 | 13 have=NGX_COMPILER value="\"Intel C Compiler $NGX_ICC_VER\"" . auto/define |
14 | |
521 | 15 |
455 | 16 # optimizations |
17 | |
18 CFLAGS="$CFLAGS -O" | |
19 | |
469 | 20 CORE_LINK="$CORE_LINK -opt_report_file=$NGX_OBJS/opt_report_file" |
455 | 21 |
573 | 22 |
455 | 23 case $CPU in |
24 pentium) | |
25 # optimize for Pentium and Athlon | |
26 CPU_OPT="-march=pentium" | |
27 ;; | |
28 | |
29 pentiumpro) | |
30 # optimize for Pentium Pro, Pentium II and Pentium III | |
31 CPU_OPT="-mcpu=pentiumpro -march=pentiumpro" | |
32 ;; | |
33 | |
34 pentium4) | |
35 # optimize for Pentium 4, default | |
36 CPU_OPT="-march=pentium4" | |
37 ;; | |
38 esac | |
39 | |
40 CFLAGS="$CFLAGS $CPU_OPT" | |
41 | |
42 if [ ".$PCRE_OPT" = "." ]; then | |
4395
7ee8e11e17bb
Some questionable optomizations flags for icc were removed
Maxim Konovalov <maxim@nginx.com>
parents:
1171
diff
changeset
|
43 PCRE_OPT="-O $CPU_OPT" |
455 | 44 fi |
45 | |
46 if [ ".$ZLIB_OPT" = "." ]; then | |
4395
7ee8e11e17bb
Some questionable optomizations flags for icc were removed
Maxim Konovalov <maxim@nginx.com>
parents:
1171
diff
changeset
|
47 ZLIB_OPT="-O $CPU_OPT" |
455 | 48 fi |
49 | |
50 | |
51 # warnings | |
52 | |
501 | 53 CFLAGS="$CFLAGS -w2" |
54 | |
55 # disable some warnings | |
455 | 56 |
501 | 57 # invalid type conversion: "int" to "char *" |
58 CFLAGS="$CFLAGS -wd171" | |
59 # argument is incompatible with corresponding format string conversion | |
60 CFLAGS="$CFLAGS -wd181" | |
61 # zero used for undefined preprocessing identifier | |
62 CFLAGS="$CFLAGS -wd193" | |
563 | 63 # the format string ends before this argument |
519 | 64 CFLAGS="$CFLAGS -wd268" |
501 | 65 # invalid format string conversion |
66 CFLAGS="$CFLAGS -wd269" | |
67 # conversion from "long long" to "size_t" may lose significant bits | |
68 CFLAGS="$CFLAGS -wd810" | |
69 # parameter was never referenced | |
70 CFLAGS="$CFLAGS -wd869" | |
681 | 71 # attribute "unused" is only allowed in a function definition, warning on pTHX_ |
72 CFLAGS="$CFLAGS -wd1301" | |
501 | 73 |
74 # STUB | |
75 # enumerated type mixed with another type | |
76 CFLAGS="$CFLAGS -wd188" | |
77 # controlling expression is constant | |
78 CFLAGS="$CFLAGS -wd279" | |
79 # operands are evaluated in unspecified order | |
80 CFLAGS="$CFLAGS -wd981" | |
81 # external definition with no prior declaration | |
82 CFLAGS="$CFLAGS -wd1418" | |
83 # external declaration in primary source file | |
84 CFLAGS="$CFLAGS -wd1419" | |
521 | 85 |
86 case "$NGX_ICC_VER" in | |
573 | 87 9.*) |
6504 | 88 # "cc" clobber ignored, warnings for Linux's htonl()/htons() |
521 | 89 CFLAGS="$CFLAGS -wd1469" |
563 | 90 # explicit conversion of a 64-bit integral type to a smaller |
91 # integral type | |
92 CFLAGS="$CFLAGS -wd1683" | |
93 # conversion from pointer to same-sized integral type, | |
94 # warning on offsetof() | |
95 CFLAGS="$CFLAGS -wd1684" | |
595 | 96 # floating-point equality and inequality comparisons are unreliable, |
97 # warning on SvTRUE() | |
98 CFLAGS="$CFLAGS -wd1572" | |
521 | 99 ;; |
100 | |
573 | 101 8.*) |
6504 | 102 # "cc" clobber ignored, warnings for Linux's htonl()/htons() |
573 | 103 CFLAGS="$CFLAGS -wd1469" |
595 | 104 # floating-point equality and inequality comparisons are unreliable, |
105 # warning on SvTRUE() | |
106 CFLAGS="$CFLAGS -wd1572" | |
573 | 107 ;; |
108 | |
521 | 109 *) |
110 ;; | |
111 esac | |
479 | 112 |
455 | 113 # stop on warning |
114 CFLAGS="$CFLAGS -Werror" | |
115 | |
116 # debug | |
117 CFLAGS="$CFLAGS -g" |