aboutsummaryrefslogtreecommitdiff
path: root/src/http/ngx_http.c
Commit message (Collapse)AuthorAge
* Upstream: early hints support.Roman Arutyunyan2025-06-19
| | | | | | | | | | | | | | | | | The change implements processing upstream early hints response in ngx_http_proxy_module and ngx_http_grpc_module. A new directive "early_hints" enables sending early hints to the client. By default, sending early hints is disabled. Example: map $http_sec_fetch_mode $early_hints { navigate $http2$http3; } early_hints $early_hints; proxy_pass http://example.com;
* Common tree insert function for QUIC and UDP connections.Roman Arutyunyan2023-05-14
| | | | | | | | | | | Previously, ngx_udp_rbtree_insert_value() was used for plain UDP and ngx_quic_rbtree_insert_value() was used for QUIC. Because of this it was impossible to initialize connection tree in ngx_create_listening() since this function is not aware what kind of listening it creates. Now ngx_udp_rbtree_insert_value() is used for both QUIC and UDP. To make is possible, a generic key field is added to ngx_udp_connection_t. It keeps client address for UDP and connection ID for QUIC.
* HTTP/3: removed "http3" parameter of "listen" directive.Roman Arutyunyan2023-05-11
| | | | The parameter has been deprecated since c851a2ed5ce8.
* Merged with the default branch.Sergey Kandaurov2023-03-29
|\
| * Added warning about redefinition of listen socket protocol options.Maxim Dounin2023-01-28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
| * Fixed handling of very long locations (ticket #2435).Maxim Dounin2023-01-26
| | | | | | | | | | | | | | | | | | | | Previously, location prefix length in ngx_http_location_tree_node_t was stored as "u_char", and therefore location prefixes longer than 255 bytes were handled incorrectly. Fix is to use "u_short" instead. With "u_short", prefixes up to 65535 bytes can be safely used, and this isn't reachable due to NGX_CONF_BUFFER, which is 4096 bytes.
* | HTTP/3: "quic" parameter of "listen" directive.Roman Arutyunyan2023-02-27
| | | | | | | | | | | | | | | | | | Now "listen" directve has a new "quic" parameter which enables QUIC protocol for the address. Further, to enable HTTP/3, a new directive "http3" is introduced. The hq-interop protocol is enabled by "http3_hq" as before. Now application protocol is chosen by ALPN. Previously used "http3" parameter of "listen" is deprecated.
* | QUIC: separate UDP framework for QUIC.Roman Arutyunyan2022-04-20
| | | | | | | | | | | | | | Previously, QUIC used the existing UDP framework, which was created for UDP in Stream. However the way QUIC connections are created and looked up is different from the way UDP connections in Stream are created and looked up. Now these two implementations are decoupled.
* | HTTP/3: removed useless warning regarding OpenSSL library.Sergey Kandaurov2022-01-13
| | | | | | | | After 0e6528551f26, it became impossible to run into this path.
* | HTTP/3: http3_hq directive and NGX_HTTP_V3_HQ macro.Roman Arutyunyan2021-12-04
| | | | | | | | Listen quic parameter is no longer supported.
* | HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.Roman Arutyunyan2021-12-06
| |
* | Merged with the default branch.Sergey Kandaurov2021-11-03
|\|
| * HTTP/2: removed support for NPN.Vladimir Homutov2021-10-15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | NPN was replaced with ALPN, published as RFC 7301 in July 2014. It used to negotiate SPDY (and, in transition, HTTP/2). NPN supported appeared in OpenSSL 1.0.1. It does not work with TLSv1.3 [1]. ALPN is supported since OpenSSL 1.0.2. The NPN support was dropped in Firefox 53 [2] and Chrome 51 [3]. [1] https://github.com/openssl/openssl/issues/3665. [2] https://bugzilla.mozilla.org/show_bug.cgi?id=1248198 [3] https://www.chromestatus.com/feature/5767920709795840
* | Removed NGX_OPENSSL_QUIC macro, NGX_QUIC is enough.Ruslan Ermilov2021-09-14
| |
* | Merged with the default branch.Sergey Kandaurov2021-05-28
|\|
| * Location header escaping in redirects (ticket #882).Ruslan Ermilov2021-05-24
| | | | | | | | | | The header is escaped in redirects based on request URI or location name (auto redirect).
* | Merged with the default branch.Sergey Kandaurov2021-02-17
|\|
| * Core: removed post_accept_timeout.Maxim Dounin2021-01-19
| | | | | | | | | | | | | | | | | | | | Keeping post_accept_timeout in ngx_listening_t is no longer needed since we've switched to 1 second timeout for deferred accept in 5541:fdb67cfc957d. Further, using it in HTTP code can result in client_header_timeout being used from an incorrect server block, notably if address-specific virtual servers are used along with a wildcard listening socket, or if we've switched to a different server block based on SNI in SSL handshake.
* | QUIC: added "quic" listen parameter.Roman Arutyunyan2020-07-21
| | | | | | | | | | | | The parameter allows processing HTTP/0.9-2 over QUIC. Also, introduced ngx_http_quic_module and moved QUIC settings there
* | Merged with the default branch.Sergey Kandaurov2020-07-13
|\|
| * Fixed potential leak of temp pool.Eran Kornblau2020-06-15
| | | | | | | | | | In case ngx_hash_add_key() fails, need to goto failed instead of returning, so that temp_pool will be destoryed.
* | Do not close QUIC sockets in ngx_close_listening_sockets().Sergey Kandaurov2020-06-23
| | | | | | | | This breaks graceful shutdown of QUIC connections in terms of quic-transport.
* | Added propagation of the "wildcard" flag to c->listening.Vladimir Homutov2020-05-29
| | | | | | | | | | | | The flags was originally added by 8f038068f4bc, and is propagated correctly in the stream module. With QUIC introduction, http module now uses datagram sockets as well, thus the fix.
* | Initial QUIC support in http.Sergey Kandaurov2020-02-28
| |
* | HTTP UDP layer, QUIC support autotest.Sergey Kandaurov2020-02-28
|/
* Multiple addresses in "listen".Roman Arutyunyan2019-03-15
| | | | | | Previously only one address was used by the listen directive handler even if host name resolved to multiple addresses. Now a separate listening socket is created for each address.
* Events: moved sockets cloning to ngx_event_init_conf().Maxim Dounin2018-07-12
| | | | | | | | | Previously, listenings sockets were not cloned if the worker_processes directive was specified after "listen ... reuseport". This also simplifies upcoming configuration check on the number of worker connections, as it needs to know the number of listening sockets before cloning.
* Precontent phase.Roman Arutyunyan2017-07-20
| | | | | | | The phase is added instead of the try_files phase. Unlike the old phase, the new one supports registering multiple handlers. The try_files implementation is moved to a separate ngx_http_try_files_module, which now registers a precontent phase handler.
* Style.Alex Zhang2017-07-19
| | | | Signed-off-by: Alex Zhang <zchao1995@gmail.com>
* The size of cmcf->phase_engine.handlers explained.Ruslan Ermilov2016-12-13
|
* Modules compatibility: removed unneeded IPV6_V6ONLY checks.Maxim Dounin2016-10-03
| | | | | | | | | | The IPV6_V6ONLY macro is now checked only while parsing appropriate flag and when using the macro. The ipv6only field in listen structures is always initialized to 1, even if not supported on a given platform. This is expected to prevent a module compiled without IPV6_V6ONLY from accidentally creating dual sockets if loaded into main binary with proper IPV6_V6ONLY support.
* Introduced ngx_inet_get_port() and ngx_inet_set_port() functions.Roman Arutyunyan2016-06-20
|
* Renamed "u" to "sockaddr" in listen options types.Maxim Dounin2016-05-23
|
* Use ngx_cmp_sockaddr() where appropriate.Ruslan Ermilov2016-05-20
|
* Dynamic modules: changed ngx_modules to cycle->modules.Maxim Dounin2016-02-04
|
* Dynamic modules: moved module-related stuff to separate files.Maxim Dounin2016-02-04
|
* Fixed PROXY protocol on IPv6 sockets (ticket #858).Maxim Dounin2015-12-17
|
* The HTTP/2 implementation (RFC 7240, 7241).Valentin Bartenev2015-09-11
| | | | The SPDY support is removed, as it's incompatible with the new module.
* Disabled duplicate http, mail, and stream blocks.Vladimir Homutov2015-06-16
| | | | | Such configurations have very limited use, introduce various problems and are not officially supported.
* The "reuseport" option of the "listen" directive.Maxim Dounin2015-05-20
| | | | | | | | | | | | | | | When configured, an individual listen socket on a given address is created for each worker process. This allows to reduce in-kernel lock contention on configurations with high accept rates, resulting in better performance. As of now it works on Linux and DragonFly BSD. Note that on Linux incoming connection requests are currently tied up to a specific listen socket, and if some sockets are closed, connection requests will be reset, see https://lwn.net/Articles/542629/. With nginx, this may happen if the number of worker processes is reduced. There is no such problem on DragonFly BSD. Based on previous work by Sepherosa Ziehau and Yingqi Lu.
* Simplified ngx_http_init_listening().Maxim Dounin2015-05-20
| | | | | | | | | | | | | There is no need to set "i" to 0, as it's expected to be 0 assuming the bindings are properly sorted, and we already rely on this when explicitly set hport->naddrs to 1. Remaining conditional code is replaced with identical "hport->naddrs = i + 1". Identical modifications are done in the mail and stream modules, in the ngx_mail_optimize_servers() and ngx_stream_optimize_servers() functions, respectively. No functional changes.
* Merge proxy_protocol setting of listen directives.Roman Arutyunyan2015-04-24
| | | | | | It's now enough to specify proxy_protocol option in one listen directive to enable it in all servers listening on the same address/port. Previously, the setting from the first directive was always used.
* Request body: filters support.Maxim Dounin2015-03-23
|
* Avoided to add duplicate hash key in ngx_http_types_slot().Gu Feng2014-09-17
|
* Fixed wrong sizeof() in ngx_http_init_locations().Maxim Dounin2014-06-26
| | | | | | There is no real difference on all known platforms, but it's still wrong. Found by Coverity (CID 400876).
* Added server-side support for PROXY protocol v1 (ticket #355).Roman Arutyunyan2014-03-17
| | | | | | | | Client address specified in the PROXY protocol header is now saved in the $proxy_protocol_addr variable and can be used in the realip module. This is currently not implemented for mail.
* SSL: support ALPN (IETF's successor to NPN).Piotr Sikora2014-01-28
| | | | Signed-off-by: Piotr Sikora <piotr@cloudflare.com>
* Added support for TCP_FASTOPEN supported in Linux >= 3.7.1.Mathew Rodley2013-12-03
| | | | | | | | | | | --- auto/unix | 12 ++++++++++++ src/core/ngx_connection.c | 32 ++++++++++++++++++++++++++++++++ src/core/ngx_connection.h | 4 ++++ src/http/ngx_http.c | 4 ++++ src/http/ngx_http_core_module.c | 21 +++++++++++++++++++++ src/http/ngx_http_core_module.h | 3 +++ 6 files changed, 76 insertions(+)
* Caseless location tree construction (ticket #90).Maxim Dounin2013-09-23
| | | | | | | | | | | | Location tree was always constructed using case-sensitive comparison, even on case-insensitive systems. This resulted in incorrect operation if uppercase letters were used in location directives. Notably, the following config: location /a { ... } location /B { ... } failed to properly map requests to "/B" into "location /B".
* Use NGX_DEFAULT_POOL_SIZE macro where appropriate.Ruslan Ermilov2013-03-21
|