Mercurial > hg > nginx-quic
annotate auto/cc/icc @ 9017:106328a70f4e
Added warning about redefinition of listen socket protocol options.
The "listen" directive in the http module can be used multiple times
in different server blocks. Originally, it was supposed to be specified
once with various socket options, and without any parameters in virtual
server blocks. For example:
server { listen 80 backlog=1024; server_name foo; ... }
server { listen 80; server_name bar; ... }
server { listen 80; server_name bazz; ... }
The address part of the syntax ("address[:port]" / "port" / "unix:path")
uniquely identifies the listening socket, and therefore is enough for
name-based virtual servers (to let nginx know that the virtual server
accepts requests on the listening socket in question).
To ensure that listening options do not conflict between virtual servers,
they were allowed only once. For example, the following configuration
will be rejected ("duplicate listen options for 0.0.0.0:80 in ..."):
server { listen 80 backlog=1024; server_name foo; ... }
server { listen 80 backlog=512; server_name bar; ... }
At some point it was, however, noticed, that it is sometimes convenient
to repeat some options for clarity. In nginx 0.8.51 the "ssl" parameter
was allowed to be specified multiple times, e.g.:
server { listen 443 ssl backlog=1024; server_name foo; ... }
server { listen 443 ssl; server_name bar; ... }
server { listen 443 ssl; server_name bazz; ... }
This approach makes configuration more readable, since SSL sockets are
immediately visible in the configuration. If this is not needed, just the
address can still be used.
Later, additional protocol-specific options similar to "ssl" were
introduced, notably "http2" and "proxy_protocol". With these options,
one can write:
server { listen 443 ssl backlog=1024; server_name foo; ... }
server { listen 443 http2; server_name bar; ... }
server { listen 443 proxy_protocol; server_name bazz; ... }
The resulting socket will use ssl, http2, and proxy_protocol, but this
is not really obvious from the configuration.
To emphasize such misleading configurations are discouraged, nginx now
warns as long as the "listen" directive is used with options different
from the options previously used if this is potentially confusing.
In particular, the following configurations are allowed:
server { listen 8401 ssl backlog=1024; server_name foo; }
server { listen 8401 ssl; server_name bar; }
server { listen 8401 ssl; server_name bazz; }
server { listen 8402 ssl http2 backlog=1024; server_name foo; }
server { listen 8402 ssl; server_name bar; }
server { listen 8402 ssl; server_name bazz; }
server { listen 8403 ssl; server_name bar; }
server { listen 8403 ssl; server_name bazz; }
server { listen 8403 ssl http2; server_name foo; }
server { listen 8404 ssl http2 backlog=1024; server_name foo; }
server { listen 8404 http2; server_name bar; }
server { listen 8404 http2; server_name bazz; }
server { listen 8405 ssl http2 backlog=1024; server_name foo; }
server { listen 8405 ssl http2; server_name bar; }
server { listen 8405 ssl http2; server_name bazz; }
server { listen 8406 ssl; server_name foo; }
server { listen 8406; server_name bar; }
server { listen 8406; server_name bazz; }
And the following configurations will generate warnings:
server { listen 8501 ssl http2 backlog=1024; server_name foo; }
server { listen 8501 http2; server_name bar; }
server { listen 8501 ssl; server_name bazz; }
server { listen 8502 backlog=1024; server_name foo; }
server { listen 8502 ssl; server_name bar; }
server { listen 8503 ssl; server_name foo; }
server { listen 8503 http2; server_name bar; }
server { listen 8504 ssl; server_name foo; }
server { listen 8504 http2; server_name bar; }
server { listen 8504 proxy_protocol; server_name bazz; }
server { listen 8505 ssl http2 proxy_protocol; server_name foo; }
server { listen 8505 ssl http2; server_name bar; }
server { listen 8505 ssl; server_name bazz; }
server { listen 8506 ssl http2; server_name foo; }
server { listen 8506 ssl; server_name bar; }
server { listen 8506; server_name bazz; }
server { listen 8507 ssl; server_name bar; }
server { listen 8507; server_name bazz; }
server { listen 8507 ssl http2; server_name foo; }
server { listen 8508 ssl; server_name bar; }
server { listen 8508; server_name bazz; }
server { listen 8508 ssl backlog=1024; server_name foo; }
server { listen 8509; server_name bazz; }
server { listen 8509 ssl; server_name bar; }
server { listen 8509 ssl backlog=1024; server_name foo; }
The basic idea is that at most two sets of protocol options are allowed:
the main one (with socket options, if any), and a shorter one, with options
being a subset of the main options, repeated for clarity. As long as the
shorter set of protocol options is used, all listen directives except the
main one should use it.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Sat, 28 Jan 2023 01:29:45 +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" |