Mercurial > hg > nginx
annotate auto/init @ 9300:5be23505292b
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 | 549b13cd793b |
children |
rev | line source |
---|---|
444
42d11f017717
nginx-0.1.0-2004-09-29-20:00:49 import; remove years from copyright
Igor Sysoev <igor@sysoev.ru>
parents:
297
diff
changeset
|
1 |
42d11f017717
nginx-0.1.0-2004-09-29-20:00:49 import; remove years from copyright
Igor Sysoev <igor@sysoev.ru>
parents:
297
diff
changeset
|
2 # Copyright (C) Igor Sysoev |
4412 | 3 # Copyright (C) Nginx, Inc. |
444
42d11f017717
nginx-0.1.0-2004-09-29-20:00:49 import; remove years from copyright
Igor Sysoev <igor@sysoev.ru>
parents:
297
diff
changeset
|
4 |
195
8dee38ea9117
nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
5 |
455 | 6 NGX_MAKEFILE=$NGX_OBJS/Makefile |
7 NGX_MODULES_C=$NGX_OBJS/ngx_modules.c | |
8 | |
9 NGX_AUTO_HEADERS_H=$NGX_OBJS/ngx_auto_headers.h | |
10 NGX_AUTO_CONFIG_H=$NGX_OBJS/ngx_auto_config.h | |
11 | |
12 NGX_AUTOTEST=$NGX_OBJS/autotest | |
13 NGX_AUTOCONF_ERR=$NGX_OBJS/autoconf.err | |
14 | |
15 # STUBs | |
469 | 16 NGX_ERR=$NGX_OBJS/autoconf.err |
17 MAKEFILE=$NGX_OBJS/Makefile | |
195
8dee38ea9117
nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
18 |
8dee38ea9117
nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
19 |
455 | 20 NGX_PCH= |
21 NGX_USE_PCH= | |
280
7c7183b3ea8b
nginx-0.0.2-2004-03-05-11:34:24 import
Igor Sysoev <igor@sysoev.ru>
parents:
254
diff
changeset
|
22 |
7c7183b3ea8b
nginx-0.0.2-2004-03-05-11:34:24 import
Igor Sysoev <igor@sysoev.ru>
parents:
254
diff
changeset
|
23 |
455 | 24 # check the echo's "-n" option and "\c" capability |
250
1903c6821958
nginx-0.0.2-2004-02-03-23:27:11 import
Igor Sysoev <igor@sysoev.ru>
parents:
210
diff
changeset
|
25 |
1903c6821958
nginx-0.0.2-2004-02-03-23:27:11 import
Igor Sysoev <igor@sysoev.ru>
parents:
210
diff
changeset
|
26 if echo "test\c" | grep c >/dev/null; then |
455 | 27 |
250
1903c6821958
nginx-0.0.2-2004-02-03-23:27:11 import
Igor Sysoev <igor@sysoev.ru>
parents:
210
diff
changeset
|
28 if echo -n test | grep n >/dev/null; then |
1903c6821958
nginx-0.0.2-2004-02-03-23:27:11 import
Igor Sysoev <igor@sysoev.ru>
parents:
210
diff
changeset
|
29 ngx_n= |
1903c6821958
nginx-0.0.2-2004-02-03-23:27:11 import
Igor Sysoev <igor@sysoev.ru>
parents:
210
diff
changeset
|
30 ngx_c= |
455 | 31 |
250
1903c6821958
nginx-0.0.2-2004-02-03-23:27:11 import
Igor Sysoev <igor@sysoev.ru>
parents:
210
diff
changeset
|
32 else |
1903c6821958
nginx-0.0.2-2004-02-03-23:27:11 import
Igor Sysoev <igor@sysoev.ru>
parents:
210
diff
changeset
|
33 ngx_n=-n |
1903c6821958
nginx-0.0.2-2004-02-03-23:27:11 import
Igor Sysoev <igor@sysoev.ru>
parents:
210
diff
changeset
|
34 ngx_c= |
1903c6821958
nginx-0.0.2-2004-02-03-23:27:11 import
Igor Sysoev <igor@sysoev.ru>
parents:
210
diff
changeset
|
35 fi |
1903c6821958
nginx-0.0.2-2004-02-03-23:27:11 import
Igor Sysoev <igor@sysoev.ru>
parents:
210
diff
changeset
|
36 |
1903c6821958
nginx-0.0.2-2004-02-03-23:27:11 import
Igor Sysoev <igor@sysoev.ru>
parents:
210
diff
changeset
|
37 else |
1903c6821958
nginx-0.0.2-2004-02-03-23:27:11 import
Igor Sysoev <igor@sysoev.ru>
parents:
210
diff
changeset
|
38 ngx_n= |
1903c6821958
nginx-0.0.2-2004-02-03-23:27:11 import
Igor Sysoev <igor@sysoev.ru>
parents:
210
diff
changeset
|
39 ngx_c='\c' |
1903c6821958
nginx-0.0.2-2004-02-03-23:27:11 import
Igor Sysoev <igor@sysoev.ru>
parents:
210
diff
changeset
|
40 fi |
452 | 41 |
42 | |
455 | 43 # create Makefile |
452 | 44 |
455 | 45 cat << END > Makefile |
452 | 46 |
2850
4e05bd832e56
fix "make upgrade" broken in r2759
Igor Sysoev <igor@sysoev.ru>
parents:
1393
diff
changeset
|
47 default: build |
452 | 48 |
49 clean: | |
455 | 50 rm -rf Makefile $NGX_OBJS |
7778
549b13cd793b
Configure: marked top-level make targets as phony.
Ruslan Ermilov <ru@nginx.com>
parents:
6425
diff
changeset
|
51 |
549b13cd793b
Configure: marked top-level make targets as phony.
Ruslan Ermilov <ru@nginx.com>
parents:
6425
diff
changeset
|
52 .PHONY: default clean |
452 | 53 END |