Mercurial > hg > nginx
annotate conf/nginx.conf @ 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 | d22eb224aedf |
children |
rev | line source |
---|---|
450 | 1 |
455 | 2 #user nobody; |
573 | 3 worker_processes 1; |
450 | 4 |
5 #error_log logs/error.log; | |
577 | 6 #error_log logs/error.log notice; |
7 #error_log logs/error.log info; | |
8 | |
450 | 9 #pid logs/nginx.pid; |
10 | |
11 | |
12 events { | |
573 | 13 worker_connections 1024; |
450 | 14 } |
15 | |
16 | |
17 http { | |
1394 | 18 include mime.types; |
450 | 19 default_type application/octet-stream; |
20 | |
2286
d795199b41ad
add double quotes around $request
Igor Sysoev <igor@sysoev.ru>
parents:
1907
diff
changeset
|
21 #log_format main '$remote_addr - $remote_user [$time_local] "$request" ' |
2684
c944cba169e3
update $status in log_format example
Igor Sysoev <igor@sysoev.ru>
parents:
2286
diff
changeset
|
22 # '$status $body_bytes_sent "$http_referer" ' |
657 | 23 # '"$http_user_agent" "$http_x_forwarded_for"'; |
577 | 24 |
25 #access_log logs/access.log main; | |
26 | |
493 | 27 sendfile on; |
577 | 28 #tcp_nopush on; |
493 | 29 |
523 | 30 #keepalive_timeout 0; |
645 | 31 keepalive_timeout 65; |
450 | 32 |
33 #gzip on; | |
34 | |
35 server { | |
577 | 36 listen 80; |
37 server_name localhost; | |
450 | 38 |
573 | 39 #charset koi8-r; |
450 | 40 |
577 | 41 #access_log logs/host.access.log main; |
450 | 42 |
43 location / { | |
44 root html; | |
45 index index.html index.htm; | |
46 } | |
47 | |
657 | 48 #error_page 404 /404.html; |
49 | |
50 # redirect server error pages to the static page /50x.html | |
51 # | |
52 error_page 500 502 503 504 /50x.html; | |
53 location = /50x.html { | |
54 root html; | |
55 } | |
56 | |
569 | 57 # proxy the PHP scripts to Apache listening on 127.0.0.1:80 |
58 # | |
59 #location ~ \.php$ { | |
60 # proxy_pass http://127.0.0.1; | |
61 #} | |
62 | |
577 | 63 # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 |
64 # | |
65 #location ~ \.php$ { | |
1907
7d47e1681a62
add "root" to the fastcgi example to set correct included DOCUMENT_ROOT
Igor Sysoev <igor@sysoev.ru>
parents:
1394
diff
changeset
|
66 # root html; |
577 | 67 # fastcgi_pass 127.0.0.1:9000; |
68 # fastcgi_index index.php; | |
611 | 69 # fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; |
1394 | 70 # include fastcgi_params; |
577 | 71 #} |
72 | |
645 | 73 # deny access to .htaccess files, if Apache's document root |
74 # concurs with nginx's one | |
481 | 75 # |
527 | 76 #location ~ /\.ht { |
481 | 77 # deny all; |
78 #} | |
450 | 79 } |
577 | 80 |
81 | |
82 # another virtual host using mix of IP-, name-, and port-based configuration | |
83 # | |
84 #server { | |
85 # listen 8000; | |
86 # listen somename:8080; | |
87 # server_name somename alias another.alias; | |
88 | |
89 # location / { | |
90 # root html; | |
91 # index index.html index.htm; | |
92 # } | |
93 #} | |
94 | |
95 | |
96 # HTTPS server | |
97 # | |
98 #server { | |
5319
50f531a55b73
Fixed misleading example SSL config.
Sergey Budnevitch <sb@waeme.net>
parents:
3938
diff
changeset
|
99 # listen 443 ssl; |
577 | 100 # server_name localhost; |
101 | |
102 # ssl_certificate cert.pem; | |
103 # ssl_certificate_key cert.key; | |
104 | |
5326 | 105 # ssl_session_cache shared:SSL:1m; |
577 | 106 # ssl_session_timeout 5m; |
107 | |
3938
1e90599af73b
use !aNULL to disable all anonymous cipher suites
Igor Sysoev <igor@sysoev.ru>
parents:
2684
diff
changeset
|
108 # ssl_ciphers HIGH:!aNULL:!MD5; |
5326 | 109 # ssl_prefer_server_ciphers on; |
577 | 110 |
111 # location / { | |
112 # root html; | |
113 # index index.html index.htm; | |
114 # } | |
115 #} | |
116 | |
450 | 117 } |