summaryrefslogtreecommitdiffhomepage
path: root/src/core (unfollow)
AgeCommit message (Collapse)AuthorFilesLines
2021-02-11Additional connections reuse.Maxim Dounin1-0/+16
If ngx_drain_connections() fails to immediately reuse any connections and there are no free connections, it now additionally tries to reuse a connection again. This helps to provide at least one free connection in case of HTTP/2 with lingering close, where merely trying to reuse a connection once does not free it, but makes it reusable again, waiting for lingering close.
2021-01-19Core: removed post_accept_timeout.Maxim Dounin1-2/+0
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.
2021-01-11Version bump.Maxim Dounin1-2/+2
2020-11-26Version bump.Ruslan Ermilov1-2/+2
2020-11-19Core: "-e" command line option.Igor Ippolitov5-16/+56
When installing or running from a non-root user it is sometimes required to override default, compiled in error log path. There was no way to do this without rebuilding the binary (ticket #147). This patch introduced "-e" command line option which allows one to override compiled in error log path.
2020-10-28Core: added format specifiers to output binary data as hex.Vladimir Homutov1-19/+68
Now "s", "V", and "v" format specifiers may be prefixed with "x" (lowercase) or "X" (uppercase) to output corresponding data in hexadecimal format. In collaboration with Maxim Dounin.
2020-11-05Version bump.Vladimir Homutov1-2/+2
2020-10-22Core: ngx_conf_set_keyval_slot() now accepts NGX_CONF_UNSET_PTR.Maxim Dounin1-1/+1
With this change, it is now possible to use ngx_conf_merge_ptr_value() to merge keyval arrays. This change actually follows much earlier changes in ngx_conf_merge_ptr_value() and ngx_conf_set_str_array_slot() in 1452:cd586e963db0 (0.6.10) and 1701:40d004d95d88 (0.6.22). To preserve compatibility with existing 3rd party modules, both NULL and NGX_CONF_UNSET_PTR are accepted for now.
2020-10-03Version bump.Maxim Dounin1-2/+2
2020-09-28Resolver: improved error messages (ticket #2024).Maxim Dounin1-16/+16
2020-08-14Version bump.Roman Arutyunyan1-2/+2
2020-08-10Core: reusing connections in advance.Maxim Dounin1-6/+5
Reworked connections reuse, so closing connections is attempted in advance, as long as number of free connections is less than 1/16 of worker connections configured. This ensures that new connections can be handled even if closing a reusable connection requires some time, for example, for a lingering close (ticket #2017). The 1/16 ratio is selected to be smaller than 1/8 used for disabling accept when working with accept mutex, so nginx will try to balance new connections to different workers first, and will start reusing connections only if this won't help.
2020-08-10Core: added a warning about reusing connections.Maxim Dounin2-0/+14
Previously, reusing connections happened silently and was only visible in monitoring systems. This was shown to be not very user-friendly, and administrators often didn't realize there were too few connections available to withstand the load, and configured timeouts (keepalive_timeout and http2_idle_timeout) were effectively reduced to keep things running. To provide at least some information about this, a warning is now logged (at most once per second, to avoid flooding the logs).
2020-07-27Core: enclosed parameters of the ngx_buf.h macros in parentheses.balus1-10/+10
2020-07-21Core: close PID file when writing fails.Ruslan Ermilov1-2/+5
Reported by Jinhua Tan.
2020-07-09Version bump.Roman Arutyunyan1-2/+2
2020-06-01Fixed removing of listening UNIX sockets when "changing binary".Ruslan Ermilov3-1/+4
When changing binary, sending a SIGTERM to the new binary's master process should not remove inherited UNIX sockets unless the old binary's master process has exited.
2020-05-26Version bump.Maxim Dounin1-2/+2
2020-04-23Version bump.Ruslan Ermilov1-2/+2
2020-03-16Version bump.Ruslan Ermilov1-2/+2
2020-02-05Version bump.Sergey Kandaurov1-2/+2
2019-12-27Version bump.Maxim Dounin1-2/+2
2019-12-05Version bump.Maxim Dounin1-2/+2
2019-10-21Parsing server PROXY protocol address and port (ticket #1206).Roman Arutyunyan2-62/+128
New variables $proxy_protocol_server_addr and $proxy_protocol_server_port are added both to HTTP and Stream.
2019-10-21Core: moved PROXY protocol fields out of ngx_connection_t.Roman Arutyunyan4-21/+42
Now a new structure ngx_proxy_protocol_t holds these fields. This allows to add more PROXY protocol fields in the future without modifying the connection structure.
2019-10-24Version bump.Roman Arutyunyan1-2/+2
2019-09-30Core: removed dead code in ngx_rbtree_delete().Vladimir Homutov1-6/+1
The result of ngx_rbtree_min() is always a node with the left child equal to sentinel, thus the check is unnecessary.
2019-09-30Version bump.Vladimir Homutov1-2/+2
2019-09-10Resolver: fixed possible use-after-free while resolving PTR.Sergey Kandaurov1-1/+2
Previously, if a response to the PTR request was cached, and ngx_resolver_dup() failed to allocate memory for the resulting name, then the original node was freed but left in expire_queue. A subsequent address resolving would end up in a use-after-free memory access of the node either in ngx_resolver_expire() or ngx_resolver_process_ptr(), when accessing it through expire_queue. The fix is to leave the resolver node intact.
2019-08-16Version bump.Maxim Dounin1-2/+2
2019-07-31Version bump.Maxim Dounin1-2/+2
2019-07-19Core: fixed memory leak on error, missed in c3f60d618c17.Maxim Dounin1-0/+1
Found by Coverity (CID 1451664).
2019-07-18Core: fixed segfault with too large bucket sizes (ticket #1806).Maxim Dounin1-5/+25
To save memory hash code uses u_short to store resulting bucket sizes, so maximum bucket size is limited to 65536 minus ngx_cacheline_size (larger values will be aligned to 65536 which will overflow u_short). However, there were no checks to enforce this, and using larger bucket sizes resulted in overflows and segmentation faults. Appropriate safety checks to enforce this added to ngx_hash_init().
2019-07-09Version bump.Maxim Dounin1-2/+2
2019-05-27Version bump.Roman Arutyunyan1-2/+2
2019-04-09Core: enabled "include" in any context (ticket #1615).Vladimir Homutov1-1/+1
2019-04-24Version bump.Vladimir Homutov1-2/+2
2019-04-15Fixed incorrect length handling in ngx_utf8_length().Maxim Dounin1-1/+1
Previously, ngx_utf8_decode() was called from ngx_utf8_length() with incorrect length, potentially resulting in out-of-bounds read when handling invalid UTF-8 strings. In practice out-of-bounds reads are not possible though, as autoindex, the only user of ngx_utf8_length(), provides null-terminated strings, and ngx_utf8_decode() anyway returns an errors when it sees a null in the middle of an UTF-8 sequence. Reported by Yunbin Liu.
2019-04-15Version bump.Maxim Dounin1-2/+2
2019-03-26Version bump.Sergey Kandaurov1-2/+2
2019-03-06Listen port ranges.Roman Arutyunyan2-29/+119
A range is specified with a dash. For each port in a range a separate listen socket is created. Examples: listen 8080-9000; listen example.com:80-88;
2019-03-20Removed sorting of getaddrinfo() results.Roman Arutyunyan1-14/+5
Previously the ngx_inet_resolve_host() function sorted addresses in a way that IPv4 addresses came before IPv6 addresses. This was implemented in eaf95350d75c (1.3.10) along with the introduction of getaddrinfo() which could resolve host names to IPv6 addresses. Since the "listen" directive only used the first address, sorting allowed to preserve "listen" compatibility with the previous behavior and with the behavior of nginx built without IPv6 support. Now "listen" uses all resolved addresses which makes sorting pointless.
2019-03-15Multiple addresses in "listen".Roman Arutyunyan2-211/+130
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.
2019-03-03Version bump.Maxim Dounin1-2/+2
2019-02-12Slab: removed redundant page calculation (ticket #1721).Maxim Dounin1-2/+1
2018-12-25Use %s for errors returned from configuration parsing handlers.Ruslan Ermilov1-1/+1
2019-01-17Version bump.Vladimir Homutov1-2/+2
2018-12-24Win32: removed NGX_DIR_MASK concept.Maxim Dounin1-2/+2
Previous interface of ngx_open_dir() assumed that passed directory name has a room for NGX_DIR_MASK at the end (NGX_DIR_MASK_LEN bytes). While all direct users of ngx_dir_open() followed this interface, this also implied similar requirements for indirect uses - in particular, via ngx_walk_tree(). Currently none of ngx_walk_tree() uses provides appropriate space, and fixing this does not look like a right way to go. Instead, ngx_dir_open() interface was changed to not require any additional space and use appropriate allocations instead.
2018-12-11Resolver: report SRV resolve failure if all A resolves failed.Roman Arutyunyan1-1/+9
Previously, if an SRV record was successfully resolved, but all of its A records failed to resolve, NXDOMAIN was returned to the caller, which is considered a successful resolve rather than an error. This could result in losing the result of a previous successful resolve by the caller. Now NXDOMAIN is only returned if at least one A resolve completed with this code. Otherwise the error state of the first A resolve is returned.
2018-12-11Version bump.Roman Arutyunyan1-2/+2