summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
...
* The "ipv4=" parameter of the "resolver" directive.Ruslan Ermilov2022-07-122-15/+54
| | | | | When set to "off", only IPv6 addresses will be resolved, and no A queries are ever sent (ticket #2196).
* SSL: logging levels of various errors added in OpenSSL 1.1.1.Maxim Dounin2022-07-121-0/+12
| | | | | | | | | Starting with OpenSSL 1.1.1, various additional errors can be reported by OpenSSL in case of client-related issues, most notably during TLSv1.3 handshakes. In particular, SSL_R_BAD_KEY_SHARE ("bad key share"), SSL_R_BAD_EXTENSION ("bad extension"), SSL_R_BAD_CIPHER ("bad cipher"), SSL_R_BAD_ECPOINT ("bad ecpoint"). These are now logged at the "info" level.
* Upstream: optimized use of SSL contexts (ticket #1234).Maxim Dounin2022-06-294-27/+235
| | | | | | | | | | | | To ensure optimal use of memory, SSL contexts for proxying are now inherited from previous levels as long as relevant proxy_ssl_* directives are not redefined. Further, when no proxy_ssl_* directives are redefined in a server block, we now preserve plcf->upstream.ssl in the "http" section configuration to inherit it to all servers. Similar changes made in uwsgi, grpc, and stream proxy.
* Version bump.Maxim Dounin2022-06-291-2/+2
|
* release-1.23.0 tagMaxim Dounin2022-06-211-0/+1
|
* nginx-1.23.0-RELEASErelease-1.23.0Maxim Dounin2022-06-211-0/+101
|
* Updated OpenSSL used for win32 builds.Maxim Dounin2022-06-211-1/+1
|
* Misc: win32 sources now preserved in release tarballs.Maxim Dounin2022-06-201-6/+0
| | | | | This makes it possible to build nginx under Windows from release tarballs instead of using source code repository.
* Contrib: vim syntax, update core and 3rd party module directives.Gena Makhomed2022-06-181-748/+264
| | | | | List of 3rd party modules github repositories are obtained from https://github.com/freebsd/freebsd-ports/blob/main/www/nginx-devel/Makefile.extmod
* Perl: removed unused variables, forgotten in ef6a3a99a81a.Sergey Kandaurov2022-06-141-2/+1
|
* Resolver: make TCP write timer event cancelable.Aleksei Bavshin2022-06-011-0/+1
| | | | | | | | | | | | | | | | | | | Similar to 70e65bf8dfd7, the change is made to ensure that the ability to cancel resolver tasks is fully controlled by the caller. As mentioned in the referenced commit, it is safe to make this timer cancelable because resolve tasks can have their own timeouts that are not cancelable. The scenario where this may become a problem is a periodic background resolve task (not tied to a specific request or a client connection), which receives a response with short TTL, large enough to warrant fallback to a TCP query. With each event loop wakeup, we either have a previously set write timer instance or schedule a new one. The non-cancelable write timer can delay or block graceful shutdown of a worker even if the ngx_resolver_ctx_t->cancelable flag is set by the API user, and there are no other tasks or connections. We use the resolver API in this way to maintain the list of upstream server addresses specified with the 'resolve' parameter, and there could be third-party modules implementing similar logic.
* Stream: don't flush empty buffers created for read errors.Aleksei Bavshin2022-05-231-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When we generate the last_buf buffer for an UDP upstream recv error, it does not contain any data from the wire. ngx_stream_write_filter attempts to forward it anyways, which is incorrect (e.g., UDP upstream ECONNREFUSED will be translated to an empty packet). This happens because we mark the buffer as both 'flush' and 'last_buf', and ngx_stream_write_filter has special handling for flush with certain types of connections (see d127837c714f, 32b0ba4855a6). The flags are meant to be mutually exclusive, so the fix is to ensure that flush and last_buf are not set at the same time. Reproduction: stream { upstream unreachable { server 127.0.0.1:8880; } server { listen 127.0.0.1:8998 udp; proxy_pass unreachable; } } 1 0.000000000 127.0.0.1 → 127.0.0.1 UDP 47 45588 → 8998 Len=5 2 0.000166300 127.0.0.1 → 127.0.0.1 UDP 47 51149 → 8880 Len=5 3 0.000172600 127.0.0.1 → 127.0.0.1 ICMP 75 Destination unreachable (Port unreachable) 4 0.000202400 127.0.0.1 → 127.0.0.1 UDP 42 8998 → 45588 Len=0 Fixes d127837c714f.
* Mp4: fixed potential overflow in ngx_http_mp4_crop_stts_data().Maxim Dounin2022-06-071-1/+1
| | | | | | | | Both "count" and "duration" variables are 32-bit, so their product might potentially overflow. It is used to reduce 64-bit start_time variable, and with very large start_time this can result in incorrect seeking. Found by Coverity (CID 1499904).
* Upstream: handling of certificates specified as an empty string.Sergey Kandaurov2022-06-075-12/+20
| | | | | | | Now, if the directive is given an empty string, such configuration cancels loading of certificates, in particular, if they would be otherwise inherited from the previous level. This restores previous behaviour, before variables support in certificates was introduced (3ab8e1e2f0f7).
* Upstream: fixed X-Accel-Expires/Cache-Control/Expires handling.Maxim Dounin2022-06-072-7/+24
| | | | | | | | | | | | | | | | | | | | | | Previously, if caching was disabled due to Expires in the past, nginx failed to cache the response even if it was cacheable as per subsequently parsed Cache-Control header (ticket #964). Similarly, if caching was disabled due to Expires in the past, "Cache-Control: no-cache" or "Cache-Control: max-age=0", caching was not used if it was cacheable as per subsequently parsed X-Accel-Expires header. Fix is to avoid disabling caching immediately after parsing Expires in the past or Cache-Control, but rather set flags which are later checked by ngx_http_upstream_process_headers() (and cleared by "Cache-Control: max-age" and X-Accel-Expires). Additionally, now X-Accel-Expires does not prevent parsing of cache control extensions, notably stale-while-revalidate and stale-if-error. This ensures that order of the X-Accel-Expires and Cache-Control headers is not important. Prodded by Vadim Fedorenko and Yugo Horie.
* Upstream: fixed build without http cache (broken by cd73509f21e2).Maxim Dounin2022-05-311-4/+5
|
* Headers filter: improved memory allocation error handling.Maxim Dounin2022-05-301-0/+4
|
* Multiple WWW-Authenticate headers with "satisfy any;".Maxim Dounin2022-05-301-2/+3
| | | | | | | | | | | | | | | If a module adds multiple WWW-Authenticate headers (ticket #485) to the response, linked in r->headers_out.www_authenticate, all headers are now cleared if another module later allows access. This change is a nop for standard modules, since the only access module which can add multiple WWW-Authenticate headers is the auth request module, and it is checked after other standard access modules. Though this might affect some third party access modules. Note that if a 3rd party module adds a single WWW-Authenticate header and not yet modified to set the header's next pointer to NULL, attempt to clear such a header with this change will result in a segmentation fault.
* Auth request: multiple WWW-Authenticate headers (ticket #485).Maxim Dounin2022-05-301-3/+8
| | | | | | When using auth_request with an upstream server which returns 401 (Unauthorized), multiple WWW-Authenticate headers from the upstream server response are now properly copied to the response.
* Upstream: multiple WWW-Authenticate headers (ticket #485).Maxim Dounin2022-05-301-9/+17
| | | | | | When using proxy_intercept_errors and an error page for error 401 (Unauthorized), multiple WWW-Authenticate headers from the upstream server response are now properly copied to the response.
* Upstream: handling of multiple Vary headers (ticket #1423).Maxim Dounin2022-05-301-5/+43
| | | | Previously, only the last header value was used when caching.
* Upstream: duplicate headers ignored or properly linked.Maxim Dounin2022-05-302-9/+104
| | | | | | | | | Most of the known duplicate upstream response headers are now ignored with a warning. If syntax permits multiple headers, these are now properly linked to the lists, notably Vary and WWW-Authenticate. This makes it possible to further handle such lists where it makes sense.
* Upstream: header handlers can now return parsing errors.Maxim Dounin2022-05-306-13/+80
| | | | | | | With this change, duplicate Content-Length and Transfer-Encoding headers are now rejected. Further, responses with invalid Content-Length or Transfer-Encoding headers are now rejected, as well as responses with both Content-Length and Transfer-Encoding.
* Upstream: all known headers in u->headers_in are linked lists now.Maxim Dounin2022-05-302-0/+11
|
* All known output headers can be linked lists now.Maxim Dounin2022-05-3014-0/+25
| | | | | | | | The h->next pointer properly provided as NULL in all cases where known output headers are added. Note that there are 3rd party modules which might not do this, and it might be risky to rely on this for arbitrary headers.
* Upstream: simplified Accept-Ranges handling.Maxim Dounin2022-05-302-3/+1
| | | | The u->headers_in.accept_ranges field is not used anywhere and hence removed.
* Upstream: simplified Content-Encoding handling.Maxim Dounin2022-05-302-37/+3
| | | | | | | | | | | | | | | Since introduction of offset handling in ngx_http_upstream_copy_header_line() in revision 573:58475592100c, the ngx_http_upstream_copy_content_encoding() function is no longer needed, as its behaviour is exactly equivalent to ngx_http_upstream_copy_header_line() with appropriate offset. As such, the ngx_http_upstream_copy_content_encoding() function was removed. Further, the u->headers_in.content_encoding field is not used anywhere, so it was removed as well. Further, Content-Encoding handling no longer depends on NGX_HTTP_GZIP, as it can be used even without any gzip handling compiled in (for example, in the charset filter).
* Upstream: style.Maxim Dounin2022-05-301-7/+17
|
* Perl: combining unknown headers during $r->header_in() lookup.Maxim Dounin2022-05-301-40/+44
|
* Perl: all known input headers are handled identically.Maxim Dounin2022-05-301-20/+2
| | | | | | | As all known input headers are now linked lists, these are now handled identically. In particular, this makes it possible to access properly combined values of headers not specifically handled previously, such as "Via" or "Connection".
* All non-unique input headers are now linked lists.Maxim Dounin2022-05-302-59/+12
| | | | | | The ngx_http_process_multi_header_lines() function is removed, as it is exactly equivalent to ngx_http_process_header_line(). Similarly, ngx_http_variable_header() is used instead of ngx_http_variable_headers().
* Reworked multi headers to use linked lists.Maxim Dounin2022-05-3017-245/+175
| | | | | | | | | | | | | | | | | Multi headers are now using linked lists instead of arrays. Notably, the following fields were changed: r->headers_in.cookies (renamed to r->headers_in.cookie), r->headers_in.x_forwarded_for, r->headers_out.cache_control, r->headers_out.link, u->headers_in.cache_control u->headers_in.cookies (renamed to u->headers_in.set_cookie). The r->headers_in.cookies and u->headers_in.cookies fields were renamed to r->headers_in.cookie and u->headers_in.set_cookie to match header names. The ngx_http_parse_multi_header_lines() and ngx_http_parse_set_cookie_lines() functions were changed accordingly. With this change, multi headers are now essentially equivalent to normal headers, and following changes will further make them equivalent.
* Combining unknown headers during variables lookup (ticket #1316).Maxim Dounin2022-05-303-21/+74
| | | | | | | | | | | | | | | | Previously, $http_*, $sent_http_*, $sent_trailer_*, $upstream_http_*, and $upstream_trailer_* variables returned only the first header (with a few specially handled exceptions: $http_cookie, $http_x_forwarded_for, $sent_http_cache_control, $sent_http_link). With this change, all headers are returned, combined together. For example, $http_foo variable will be "a, b" if there are "Foo: a" and "Foo: b" headers in the request. Note that $upstream_http_set_cookie will also return all "Set-Cookie" headers (ticket #1843), though this might not be what one want, since the "Set-Cookie" header does not follow the list syntax (see RFC 7230, section 3.2.2).
* Uwsgi: combining headers with identical names (ticket #1724).Maxim Dounin2022-05-301-6/+51
| | | | | | | | | | | The uwsgi specification states that "The uwsgi block vars represent a dictionary/hash". This implies that no duplicate headers are expected. Further, provided headers are expected to follow CGI specification, which also requires to combine headers (RFC 3875, section "4.1.18. Protocol-Specific Meta-Variables"): "If multiple header fields with the same field-name are received then the server MUST rewrite them as a single value having the same semantics".
* SCGI: combining headers with identical names (ticket #1724).Maxim Dounin2022-05-301-5/+45
| | | | | | | | | | | | SCGI specification explicitly forbids headers with duplicate names (section "3. Request Format"): "Duplicate names are not allowed in the headers". Further, provided headers are expected to follow CGI specification, which also requires to combine headers (RFC 3875, section "4.1.18. Protocol-Specific Meta-Variables"): "If multiple header fields with the same field-name are received then the server MUST rewrite them as a single value having the same semantics".
* FastCGI: combining headers with identical names (ticket #1724).Maxim Dounin2022-05-305-13/+138
| | | | | | | | | | | | FastCGI responder is expected to receive CGI/1.1 environment variables in the parameters (see section "6.2 Responder" of the FastCGI specification). Obviously enough, there cannot be multiple environment variables with the same name. Further, CGI specification (RFC 3875, section "4.1.18. Protocol-Specific Meta-Variables") explicitly requires to combine headers: "If multiple header fields with the same field-name are received then the server MUST rewrite them as a single value having the same semantics".
* Perl: fixed $r->header_in("Connection").Maxim Dounin2022-05-301-0/+4
| | | | | | Previously, the r->header_in->connection pointer was never set despite being present in ngx_http_headers_in, resulting in incorrect value returned by $r->header_in("Connection") in embedded perl.
* Fixed runtime handling of systems without EPOLLRDHUP support.Marcus Ball2022-05-302-2/+6
| | | | | | | | | | | | | | | | | | | | | | In 7583:efd71d49bde0 (nginx 1.17.5) along with introduction of the ioctl(FIONREAD) support proper handling of systems without EPOLLRDHUP support in the kernel (but with EPOLLRDHUP in headers) was broken. Before the change, rev->available was never set to 0 unless ngx_use_epoll_rdhup was also set (that is, runtime test for EPOLLRDHUP introduced in 6536:f7849bfb6d21 succeeded). After the change, rev->available might reach 0 on systems without runtime EPOLLRDHUP support, stopping further reading in ngx_readv_chain() and ngx_unix_recv(). And, if EOF happened to be already reported along with the last event, it is not reported again by epoll_wait(), leading to connection hangs and timeouts on such systems. This affects Linux kernels before 2.6.17 if nginx was compiled with newer headers, and, more importantly, emulation layers, such as DigitalOcean's App Platform's / gVisor's epoll emulation layer. Fix is to explicitly check ngx_use_epoll_rdhup before the corresponding rev->pending_eof tests in ngx_readv_chain() and ngx_unix_recv().
* Version bump.Maxim Dounin2022-05-301-2/+2
|
* Updated OpenSSL and zlib used for win32 builds.Maxim Dounin2022-05-241-2/+2
|
* Configure: recognize arm64 machine name as a synonym for aarch64.Sergey Kandaurov2022-04-291-1/+1
| | | | | In particular, this sets a reasonable cacheline size on FreeBSD and macOS, which prefer to use this name and both lack _SC_LEVEL1_DCACHE_LINESIZE.
* SSL: logging level of "application data after close notify".Sergey Kandaurov2022-02-081-0/+6
| | | | | | | | | Such fatal errors are reported by OpenSSL 1.1.1, and similarly by BoringSSL, if application data is encountered during SSL shutdown, which started to be observed on the second SSL_shutdown() call after SSL shutdown fixes made in 09fb2135a589 (1.19.2). The error means that the client continues to send application data after receiving the "close_notify" alert (ticket #2318). Previously it was reported as SSL_shutdown() error of SSL_ERROR_SYSCALL.
* Year 2022.Sergey Kandaurov2022-02-041-1/+1
|
* HTTP/2: fixed closed_nodes overflow (ticket #1708).Maxim Dounin2022-02-031-1/+1
| | | | | | | | | | | With large http2_max_concurrent_streams or http2_max_concurrent_pushes, more than 255 ngx_http_v2_node_t structures might be allocated, eventually leading to h2c->closed_nodes overflow when closing corresponding streams. This will in turn result in additional allocations in ngx_http_v2_get_node_by_id(). While mostly harmless, it can result in excessive memory usage by a HTTP/2 connection, notably in configurations with many keepalive_requests allowed. Fix is to use ngx_uint_t for h2c->closed_nodes instead of unsigned:8.
* HTTP/2: made it possible to flush response headers (ticket #1743).Maxim Dounin2022-02-036-3/+14
| | | | | | | | | | | | | | | | Response headers can be buffered in the SSL buffer. But stream's fake connection buffered flag did not reflect this, so any attempts to flush the buffer without sending additional data were stopped by the write filter. It does not seem to be possible to reflect this in fc->buffered though, as we never known if main connection's c->buffered corresponds to the particular stream or not. As such, fc->buffered might prevent request finalization due to sending data on some other stream. Fix is to implement handling of flush buffers when the c->need_flush_buf flag is set, similarly to the existing last buffer handling. The same flag is now used for UDP sockets in the stream module instead of explicit checking of c->type.
* Cache: fixed race in ngx_http_file_cache_forced_expire().Maxim Dounin2022-02-011-0/+5
| | | | | | | | | | | | | During configuration reload two cache managers might exist for a short time. If both tried to delete the same cache node, the "ignore long locked inactive cache entry" alert appeared in logs. Additionally, ngx_http_file_cache_forced_expire() might be also called by worker processes, with similar results. Fix is to ignore cache nodes being deleted, similarly to how it is done in ngx_http_file_cache_expire() since 3755:76e3a93821b1. This was somehow missed in 7002:ab199f0eb8e8, when ignoring long locked cache entries was introduced in ngx_http_file_cache_forced_expire().
* Core: added autotest for UDP segmentation offloading.Vladimir Homutov2022-01-262-0/+20
|
* Core: added function for local source address cmsg.Vladimir Homutov2022-01-253-82/+77
|
* Core: made the ngx_sendmsg() function non-static.Vladimir Homutov2022-01-252-70/+127
| | | | | The NGX_HAVE_ADDRINFO_CMSG macro is defined when at least one of methods to deal with corresponding control message is available.
* Core: the ngx_event_udp.h header file.Vladimir Homutov2022-01-253-7/+27
|