annotate auto/types/uintptr_t @ 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 a616bdc38645
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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: 370
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: 370
diff changeset
2 # Copyright (C) Igor Sysoev
4412
d620f497c50f Copyright updated.
Maxim Konovalov <maxim@nginx.com>
parents: 1354
diff changeset
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: 370
diff changeset
4
192
31824be1fc66 nginx-0.0.1-2003-11-20-10:05:50 import; auto/configure
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
5
455
295d97d70c69 nginx-0.1.2-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 444
diff changeset
6 echo $ngx_n "checking for uintptr_t ...$ngx_c"
6269
7ec809b579d7 Configure: style fixes for autoconf.err.
Piotr Sikora <piotrsikora@google.com>
parents: 5309
diff changeset
7
7ec809b579d7 Configure: style fixes for autoconf.err.
Piotr Sikora <piotrsikora@google.com>
parents: 5309
diff changeset
8 cat << END >> $NGX_AUTOCONF_ERR
7ec809b579d7 Configure: style fixes for autoconf.err.
Piotr Sikora <piotrsikora@google.com>
parents: 5309
diff changeset
9
7ec809b579d7 Configure: style fixes for autoconf.err.
Piotr Sikora <piotrsikora@google.com>
parents: 5309
diff changeset
10 ----------------------------------------
7ec809b579d7 Configure: style fixes for autoconf.err.
Piotr Sikora <piotrsikora@google.com>
parents: 5309
diff changeset
11 checking for uintptr_t
7ec809b579d7 Configure: style fixes for autoconf.err.
Piotr Sikora <piotrsikora@google.com>
parents: 5309
diff changeset
12
7ec809b579d7 Configure: style fixes for autoconf.err.
Piotr Sikora <piotrsikora@google.com>
parents: 5309
diff changeset
13 END
192
31824be1fc66 nginx-0.0.1-2003-11-20-10:05:50 import; auto/configure
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
14
210
00cafae0bdf1 nginx-0.0.1-2003-12-14-23:10:27 import
Igor Sysoev <igor@sysoev.ru>
parents: 196
diff changeset
15 found=no
00cafae0bdf1 nginx-0.0.1-2003-12-14-23:10:27 import
Igor Sysoev <igor@sysoev.ru>
parents: 196
diff changeset
16
00cafae0bdf1 nginx-0.0.1-2003-12-14-23:10:27 import
Igor Sysoev <igor@sysoev.ru>
parents: 196
diff changeset
17 cat << END > $NGX_AUTOTEST.c
00cafae0bdf1 nginx-0.0.1-2003-12-14-23:10:27 import
Igor Sysoev <igor@sysoev.ru>
parents: 196
diff changeset
18
00cafae0bdf1 nginx-0.0.1-2003-12-14-23:10:27 import
Igor Sysoev <igor@sysoev.ru>
parents: 196
diff changeset
19 #include <sys/types.h>
6625
a616bdc38645 Configure: stop polluting NGX_ namespace.
Piotr Sikora <piotrsikora@google.com>
parents: 6624
diff changeset
20 $NGX_INCLUDE_INTTYPES_H
192
31824be1fc66 nginx-0.0.1-2003-11-20-10:05:50 import; auto/configure
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
21
6624
e3faa5fb7772 Configure: fix build with -Werror=old-style-definition.
Piotr Sikora <piotrsikora@google.com>
parents: 6269
diff changeset
22 int main(void) {
4559
62d8db8c7157 Fixed more gcc46 warnings in configure tests.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4543
diff changeset
23 uintptr_t i = 0;
62d8db8c7157 Fixed more gcc46 warnings in configure tests.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4543
diff changeset
24 return (int) i;
210
00cafae0bdf1 nginx-0.0.1-2003-12-14-23:10:27 import
Igor Sysoev <igor@sysoev.ru>
parents: 196
diff changeset
25 }
192
31824be1fc66 nginx-0.0.1-2003-11-20-10:05:50 import; auto/configure
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
26
210
00cafae0bdf1 nginx-0.0.1-2003-12-14-23:10:27 import
Igor Sysoev <igor@sysoev.ru>
parents: 196
diff changeset
27 END
192
31824be1fc66 nginx-0.0.1-2003-11-20-10:05:50 import; auto/configure
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
28
4543
51744fa997c7 Fixed compilation warnings in configuration C tests.
Ruslan Ermilov <ru@nginx.com>
parents: 4412
diff changeset
29 ngx_test="$CC $CC_TEST_FLAGS $CC_AUX_FLAGS \
51744fa997c7 Fixed compilation warnings in configuration C tests.
Ruslan Ermilov <ru@nginx.com>
parents: 4412
diff changeset
30 -o $NGX_AUTOTEST $NGX_AUTOTEST.c $NGX_LD_OPT"
51744fa997c7 Fixed compilation warnings in configuration C tests.
Ruslan Ermilov <ru@nginx.com>
parents: 4412
diff changeset
31
51744fa997c7 Fixed compilation warnings in configuration C tests.
Ruslan Ermilov <ru@nginx.com>
parents: 4412
diff changeset
32 eval "$ngx_test >> $NGX_AUTOCONF_ERR 2>&1"
210
00cafae0bdf1 nginx-0.0.1-2003-12-14-23:10:27 import
Igor Sysoev <igor@sysoev.ru>
parents: 196
diff changeset
33
00cafae0bdf1 nginx-0.0.1-2003-12-14-23:10:27 import
Igor Sysoev <igor@sysoev.ru>
parents: 196
diff changeset
34 if [ -x $NGX_AUTOTEST ]; then
00cafae0bdf1 nginx-0.0.1-2003-12-14-23:10:27 import
Igor Sysoev <igor@sysoev.ru>
parents: 196
diff changeset
35 echo " uintptr_t found"
00cafae0bdf1 nginx-0.0.1-2003-12-14-23:10:27 import
Igor Sysoev <igor@sysoev.ru>
parents: 196
diff changeset
36 found=yes
195
8dee38ea9117 nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents: 193
diff changeset
37 else
250
1903c6821958 nginx-0.0.2-2004-02-03-23:27:11 import
Igor Sysoev <igor@sysoev.ru>
parents: 210
diff changeset
38 echo $ngx_n " uintptr_t not found" $ngx_c
195
8dee38ea9117 nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents: 193
diff changeset
39 fi
192
31824be1fc66 nginx-0.0.1-2003-11-20-10:05:50 import; auto/configure
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
40
5309
434548349838 Configure: fixed autotest cleanup commands.
Sergey Kandaurov <pluknet@nginx.com>
parents: 4559
diff changeset
41 rm -rf $NGX_AUTOTEST*
192
31824be1fc66 nginx-0.0.1-2003-11-20-10:05:50 import; auto/configure
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
42
31824be1fc66 nginx-0.0.1-2003-11-20-10:05:50 import; auto/configure
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
43
210
00cafae0bdf1 nginx-0.0.1-2003-12-14-23:10:27 import
Igor Sysoev <igor@sysoev.ru>
parents: 196
diff changeset
44 if [ $found = no ]; then
370
54f76b0b8dca nginx-0.0.7-2004-06-27-22:01:57 import
Igor Sysoev <igor@sysoev.ru>
parents: 250
diff changeset
45 found="uint`expr 8 \* $ngx_ptr_size`_t"
210
00cafae0bdf1 nginx-0.0.1-2003-12-14-23:10:27 import
Igor Sysoev <igor@sysoev.ru>
parents: 196
diff changeset
46 echo ", $found used"
00cafae0bdf1 nginx-0.0.1-2003-12-14-23:10:27 import
Igor Sysoev <igor@sysoev.ru>
parents: 196
diff changeset
47
1354
f69d1aab6a0f make 64-bit ngx_int_t on 64-bit platforms
Igor Sysoev <igor@sysoev.ru>
parents: 455
diff changeset
48 echo "typedef $found uintptr_t;" >> $NGX_AUTO_CONFIG_H
f69d1aab6a0f make 64-bit ngx_int_t on 64-bit platforms
Igor Sysoev <igor@sysoev.ru>
parents: 455
diff changeset
49 echo "typedef $found intptr_t;" | sed -e 's/u//g' >> $NGX_AUTO_CONFIG_H
192
31824be1fc66 nginx-0.0.1-2003-11-20-10:05:50 import; auto/configure
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
50 fi