summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* release-1.22.1 tagbranches/stable-1.22Maxim Dounin2022-10-191-0/+1
|
* nginx-1.22.1-RELEASErelease-1.22.1Maxim Dounin2022-10-191-0/+22
|
* Mp4: disabled duplicate atoms.Roman Arutyunyan2022-10-191-0/+147
| | | | | | Most atoms should not appear more than once in a container. Previously, this was not enforced by the module, which could result in worker process crash, memory corruption and disclosure.
* Updated OpenSSL used for win32 builds.Maxim Dounin2022-07-191-1/+1
|
* Updated OpenSSL used for win32 builds.Maxim Dounin2022-06-211-1/+1
|
* Version bump.Maxim Dounin2022-10-191-2/+2
|
* release-1.22.0 tagMaxim Dounin2022-05-241-0/+1
|
* nginx-1.22.0-RELEASErelease-1.22.0Maxim Dounin2022-05-241-0/+14
|
* Updated OpenSSL and zlib used for win32 builds.Maxim Dounin2022-05-241-2/+2
|
* Year 2022.Sergey Kandaurov2022-02-041-1/+1
|
* Stable branch.Maxim Dounin2022-05-241-2/+2
|
* release-1.21.6 tagMaxim Dounin2022-01-251-0/+1
|
* nginx-1.21.6-RELEASErelease-1.21.6Maxim Dounin2022-01-251-0/+38
|
* SSL: always renewing tickets with TLSv1.3 (ticket #1892).Maxim Dounin2022-01-241-1/+15
| | | | | | | | | | | Chrome only uses TLS session tickets once with TLS 1.3, likely following RFC 8446 Appendix C.4 recommendation. With OpenSSL, this works fine with built-in session tickets, since these are explicitly renewed in case of TLS 1.3 on each session reuse, but results in only two connections being reused after an initial handshake when using ssl_session_ticket_key. Fix is to always renew TLS session tickets in case of TLS 1.3 when using ssl_session_ticket_key, similarly to how it is done by OpenSSL internally.
* Contrib: vim syntax adjusted to save cpoptions (ticket #2276).Maxim Dounin2022-01-221-0/+6
| | | | | | | Line continuation as used in the syntax file might be broken if "compatible" is set or "C" is added to cpoptions. Fix is to set the "cpoptions" option to vim default value at script start and restore it later, see ":help use-cpo-save".
* Core: simplify reader lock release.Pavel Pautov2022-01-191-15/+3
|
* SSL: free pkey on SSL_CTX_set0_tmp_dh_pkey() failure.Sergey Kandaurov2022-01-171-0/+3
| | | | | The behaviour was changed in OpenSSL 3.0.1: https://git.openssl.org/?p=openssl.git;a=commitdiff;h=bf17b7b
* Avoid sending "Connection: keep-alive" when shutting down.Maxim Dounin2022-01-111-0/+4
| | | | | | | | | | | | | | | 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.
* Events: fixed balancing between workers with EPOLLEXCLUSIVE.Maxim Dounin2021-12-303-0/+64
| | | | | | | | Linux with EPOLLEXCLUSIVE usually notifies only the process which was first to add the listening socket to the epoll instance. As a result most of the connections are handled by the first worker process (ticket #2285). To fix this, we re-add the socket periodically, so other workers will get a chance to accept connections.
* Version bump.Maxim Dounin2021-12-291-2/+2
|
* release-1.21.5 tagMaxim Dounin2021-12-281-0/+1
|
* nginx-1.21.5-RELEASErelease-1.21.5Maxim Dounin2021-12-281-0/+52
|
* Updated OpenSSL and PCRE used for win32 builds.Maxim Dounin2021-12-281-2/+2
|
* Support for sendfile(SF_NOCACHE).Maxim Dounin2021-12-273-4/+25
| | | | | | The SF_NOCACHE flag, introduced in FreeBSD 11 along with the new non-blocking sendfile() implementation by glebius@, makes it possible to use sendfile() along with the "directio" directive.
* SSL: SSL_sendfile(SF_NODISKIO) support.Maxim Dounin2021-12-271-2/+29
|
* Simplified sendfile(SF_NODISKIO) usage.Maxim Dounin2021-12-278-174/+33
| | | | | | | | | | | | | | | | | | | Starting with FreeBSD 11, there is no need to use AIO operations to preload data into cache for sendfile(SF_NODISKIO) to work. Instead, sendfile() handles non-blocking loading data from disk by itself. It still can, however, return EBUSY if a page is already being loaded (for example, by a different process). If this happens, we now post an event for the next event loop iteration, so sendfile() is retried "after a short period", as manpage recommends. The limit of the number of EBUSY tolerated without any progress is preserved, but now it does not result in an alert, since on an idle system event loop iteration might be very short and EBUSY can happen many times in a row. Instead, SF_NODISKIO is simply disabled for one call once the limit is reached. With this change, sendfile(SF_NODISKIO) is now used automatically as long as sendfile() is enabled, and no longer requires "aio on;".
* Removed "aio sendfile", deprecated since 1.7.11.Maxim Dounin2021-12-271-13/+0
|
* Core: added NGX_REGEX_MULTILINE for 3rd party modules.Maxim Dounin2021-12-252-2/+11
| | | | | | | | Notably, NAXSI is known to misuse ngx_regex_compile() with rc.options set to PCRE_CASELESS | PCRE_MULTILINE. With PCRE2 support, and notably binary compatibility changes, it is no longer possible to set PCRE[2]_MULTILINE option without using proper interface. To facilitate correct usage, this change adds the NGX_REGEX_MULTILINE option.
* PCRE2 and PCRE binary compatibility.Maxim Dounin2021-12-252-15/+48
| | | | | | | | | | With this change, dynamic modules using nginx regex interface can be used regardless of the variant of the PCRE library nginx was compiled with. If a module is compiled with different PCRE library variant, in case of ngx_regex_exec() errors it will report wrong function name in error messages. This is believed to be tolerable, given that fixing this will require interface changes.
* PCRE2 library support.Maxim Dounin2021-12-256-53/+574
| | | | | | | | | | | | | | | | | | | | | | | The PCRE2 library is now used by default if found, instead of the original PCRE library. If needed for some reason, this can be disabled with the --without-pcre2 configure option. To make it possible to specify paths to the library and include files via --with-cc-opt / --with-ld-opt, the library is first tested without any additional paths and options. If this fails, the pcre2-config script is used. Similarly to the original PCRE library, it is now possible to build PCRE2 from sources with nginx configure, by using the --with-pcre= option. It automatically detects if PCRE or PCRE2 sources are provided. Note that compiling PCRE2 10.33 and later requires inttypes.h. When compiling on Windows with MSVC, inttypes.h is only available starting with MSVC 2013. In older versions some replacement needs to be provided ("echo '#include <stdint.h>' > pcre2-10.xx/src/inttypes.h" is good enough for MSVC 2010). The interface on nginx side remains unchanged.
* Configure: simplified PCRE compilation.Maxim Dounin2021-12-251-65/+8
| | | | | | Removed ICC-specific PCRE optimizations which tried to link with PCRE object files instead of the library. Made compiler-specific code minimal.
* Core: ngx_regex.c style cleanup.Maxim Dounin2021-12-251-17/+17
| | | | | Notably, ngx_pcre_pool and ngx_pcre_studies are renamed to ngx_regex_pool and ngx_regex_studies, respectively.
* Core: fixed ngx_pcre_studies cleanup.Maxim Dounin2021-12-251-40/+43
| | | | | | | | | | | | If a configuration parsing fails for some reason, ngx_regex_module_init() is not called, and ngx_pcre_studies remained set despite the fact that the pool it was allocated from is already freed. This might result in a segmentation fault during runtime regular expression compilation, such as in SSI, for example, in the single process mode, or if a worker process died and was respawned from a master process in such an inconsistent state. Fix is to clear ngx_pcre_studies from the pool cleanup handler (which is anyway used to free JIT-compiled patterns).
* Moved Huffman coding out of HTTP/2.Ruslan Ermilov2021-12-219-45/+53
| | | | | ngx_http_v2_huff_decode.c and ngx_http_v2_huff_encode.c are renamed to ngx_http_huff_decode.c and ngx_http_huff_encode.c.
* Contrib: vim syntax, update core and 3rd party module directives.Gena Makhomed2021-12-201-1/+39
|
* HTTP/2: fixed sendfile() aio handling.Maxim Dounin2021-11-253-10/+65
| | | | | | | | | | | | | | | | | | | | | | | | | | With sendfile() in threads ("aio threads; sendfile on;"), client connection can block on writing, waiting for sendfile() to complete. In HTTP/2 this might result in the request hang, since an attempt to continue processing in thread event handler will call request's write event handler, which is usually stopped by ngx_http_v2_send_chain(): it does nothing if there are no additional data and stream->queued is set. Further, HTTP/2 resets stream's c->write->ready to 0 if writing blocks, so just fixing ngx_http_v2_send_chain() is not enough. Can be reproduced with test suite on Linux with: TEST_NGINX_GLOBALS_HTTP="aio threads; sendfile on;" prove h2*.t The following tests currently fail: h2_keepalive.t, h2_priority.t, h2_proxy_max_temp_file_size.t, h2.t, h2_trailers.t. Similarly, sendfile() with AIO preloading on FreeBSD can block as well, with similar results. This is, however, harder to reproduce, especially on modern FreeBSD systems, since sendfile() usually does not return EBUSY. Fix is to modify ngx_http_v2_send_chain() so it actually tries to send data to the main connection when called, and to make sure that c->write->ready is set by the relevant event handlers.
* HTTP/2: fixed "task already active" with sendfile in threads.Maxim Dounin2021-11-254-24/+58
| | | | | | | | | | | | | | | | | | | With sendfile in threads, "task already active" alerts might appear in logs if a write event happens on the main HTTP/2 connection, triggering a sendfile in threads while another thread operation is already running. Observed with "aio threads; aio_write on; sendfile on;" and with thread event handlers modified to post a write event to the main HTTP/2 connection (though can happen without any modifications). Similarly, sendfile() with AIO preloading on FreeBSD can trigger duplicate aio operation, resulting in "second aio post" alerts. This is, however, harder to reproduce, especially on modern FreeBSD systems, since sendfile() usually does not return EBUSY. Fix is to avoid starting a sendfile operation if other thread operation is active by checking r->aio in the thread handler (and, similarly, in aio preload handler). The added check also makes duplicate calls protection redundant, so it is removed.
* SSL: $ssl_curve (ticket #2135).Sergey Kandaurov2021-11-014-0/+44
| | | | | | | | | | | | | | | The variable contains a negotiated curve used for the handshake key exchange process. Known curves are listed by their names, unknown ones are shown in hex. Note that for resumed sessions in TLSv1.2 and older protocols, $ssl_curve contains the curve used during the initial handshake, while in TLSv1.3 it contains the curve used during the session resumption (see the SSL_get_negotiated_group manual page for details). The variable is only meaningful when using OpenSSL 3.0 and above. With older versions the variable is empty.
* Version bump.Sergey Kandaurov2021-11-231-2/+2
|
* release-1.21.4 tagMaxim Dounin2021-11-021-0/+1
|
* nginx-1.21.4-RELEASErelease-1.21.4Maxim Dounin2021-11-021-0/+131
|
* Changed ngx_chain_update_chains() to test tag first (ticket #2248).Maxim Dounin2021-10-301-4/+4
| | | | | | | | | | | | | | | | | | | | | Without this change, aio used with HTTP/2 can result in connection hang, as observed with "aio threads; aio_write on;" and proxying (ticket #2248). The problem is that HTTP/2 updates buffers outside of the output filters (notably, marks them as sent), and then posts a write event to call output filters. If a filter does not call the next one for some reason (for example, because of an AIO operation in progress), this might result in a state when the owner of a buffer already called ngx_chain_update_chains() and can reuse the buffer, while the same buffer is still sitting in the busy chain of some other filter. In the particular case a buffer was sitting in output chain's ctx->busy, and was reused by event pipe. Output chain's ctx->busy was permanently blocked by it, and this resulted in connection hang. Fix is to change ngx_chain_update_chains() to skip buffers from other modules unconditionally, without trying to wait for these buffers to become empty.
* Changed default value of sendfile_max_chunk to 2m.Maxim Dounin2021-10-291-1/+1
| | | | | | | The "sendfile_max_chunk" directive is important to prevent worker monopolization by fast connections. The 2m value implies maximum 200ms delay with 100 Mbps links, 20ms delay with 1 Gbps links, and 2ms on 10 Gbps links. It also seems to be a good value for disks.
* Upstream: sendfile_max_chunk support.Maxim Dounin2021-10-292-3/+10
| | | | | | | Previously, connections to upstream servers used sendfile() if it was enabled, but never honored sendfile_max_chunk. This might result in worker monopolization for a long time if large request bodies are allowed.
* Fixed sendfile() limit handling on Linux.Maxim Dounin2021-10-291-1/+3
| | | | | | | | | | | On Linux starting with 2.6.16, sendfile() silently limits all operations to MAX_RW_COUNT, defined as (INT_MAX & PAGE_MASK). This incorrectly triggered the interrupt check, and resulted in 0-sized writev() on the next loop iteration. Fix is to make sure the limit is always checked, so we will return from the loop if the limit is already reached even if number of bytes sent is not exactly equal to the number of bytes we've tried to send.
* Simplified sendfile_max_chunk handling.Maxim Dounin2021-10-291-5/+1
| | | | | | | | | | | | | | Previously, it was checked that sendfile_max_chunk was enabled and almost whole sendfile_max_chunk was sent (see e67ef50c3176), to avoid delaying connections where sendfile_max_chunk wasn't reached (for example, when sending responses smaller than sendfile_max_chunk). Now we instead check if there are unsent data, and the connection is still ready for writing. Additionally we also check c->write->delayed to ignore connections already delayed by limit_rate. This approach is believed to be more robust, and correctly handles not only sendfile_max_chunk, but also internal limits of c->send_chain(), such as sendfile() maximum supported length (ticket #1870).
* Switched to using posted next events after sendfile_max_chunk.Maxim Dounin2021-10-291-2/+1
| | | | | | | | | | Previously, 1 millisecond delay was used instead. In certain edge cases this might result in noticeable performance degradation though, notably on Linux with typical CONFIG_HZ=250 (so 1ms delay becomes 4ms), sendfile_max_chunk 2m, and link speed above 2.5 Gbps. Using posted next events removes the artificial delay and makes processing fast in all cases.
* Mp4: mp4_start_key_frame directive.Roman Arutyunyan2021-10-281-27/+194
| | | | | | | | | | | | | | The directive enables including all frames from start time to the most recent key frame in the result. Those frames are removed from presentation timeline using mp4 edit lists. Edit lists are currently supported by popular players and browsers such as Chrome, Safari, QuickTime and ffmpeg. Among those not supporting them properly is Firefox[1]. Based on a patch by Tracey Jaquith, Internet Archive. [1] https://bugzilla.mozilla.org/show_bug.cgi?id=1735300
* Mp4: added ngx_http_mp4_update_mdhd_atom() function.Roman Arutyunyan2021-10-281-8/+32
| | | | | | The function updates the duration field of mdhd atom. Previously it was updated in ngx_http_mp4_read_mdhd_atom(). The change makes it possible to alter track duration as a result of processing track frames.
* Core: removed unnecessary restriction in hash initialization.Alexey Radkov2021-08-191-0/+4
| | | | | | | | | | | Hash initialization ignores elements with key.data set to NULL. Nevertheless, the initial hash bucket size check didn't skip them, resulting in unnecessary restrictions on, for example, variables with long names and with the NGX_HTTP_VARIABLE_NOHASH flag. Fix is to update the initial hash bucket size check to skip elements with key.data set to NULL, similarly to how it is done in other parts of the code.