Mercurial > hg > nginx-quic
annotate auto/init @ 8805:96ae8e57b3dd
Avoid sending "Connection: keep-alive" when shutting down.
When a worker process is shutting down, keepalive is not used: this is checked
before the ngx_http_set_keepalive() call in ngx_http_finalize_connection().
Yet the "Connection: keep-alive" header was still sent, even if we know that
the worker process is shutting down, potentially resulting in additional
requests being sent to the connection which is going to be closed anyway.
While clients are expected to be able to handle asynchronous close events
(see ticket #1022), it is certainly possible to send the "Connection: close"
header instead, informing the client that the connection is going to be closed
and potentially saving some unneeded work.
With this change, we additionally check for worker process shutdown just
before sending response headers, and disable keepalive accordingly.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Tue, 11 Jan 2022 02:23:49 +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 |
8327
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 |