summaryrefslogtreecommitdiffhomepage
path: root/src/core (follow)
AgeCommit message (Collapse)AuthorFilesLines
2021-09-03Version bump.Roman Arutyunyan1-2/+2
2021-08-03Version bump.Maxim Dounin1-2/+2
2021-06-28Core: escaping of chars not allowed in URIs per RFC 3986.Maxim Dounin1-16/+29
Per RFC 3986 only the following characters are allowed in URIs unescaped: unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~" gen-delims = ":" / "/" / "?" / "#" / "[" / "]" / "@" sub-delims = "!" / "$" / "&" / "'" / "(" / ")" / "*" / "+" / "," / ";" / "=" And "%" can appear as a part of escaping itself. The following characters are not allowed and need to be escaped: %00-%1F, %7F-%FF, " ", """, "<", ">", "\", "^", "`", "{", "|", "}". Not escaping ">" is known to cause problems at least with MS Exchange (see http://nginx.org/pipermail/nginx-ru/2010-January/031261.html) and in Tomcat (ticket #2191). The patch adds escaping of the following chars in all URI parts: """, "<", ">", "\", "^", "`", "{", "|", "}". Note that comments are mostly preserved to outline important characters being escaped.
2021-06-28Core: fixed comment about escaping in arguments.Maxim Dounin1-1/+1
After 4954530db2af, the ";" character is escaped by ngx_escape_uri(NGX_ESCAPE_ARGS).
2021-06-21Core: added the ngx_rbtree_data() macro.Vladimir Homutov2-3/+4
2021-05-31Core: disabled SO_REUSEADDR on UDP sockets while testing config.Maxim Dounin1-11/+14
On Linux, SO_REUSEADDR allows completely duplicate UDP sockets, so using SO_REUSEADDR when testing configuration results in packets being dropped if there is an existing traffic on the sockets being tested (ticket #2187). While dropped packets are expected with UDP, it is better to avoid this when possible. With this change, SO_REUSEADDR is no longer set on datagram sockets when testing configuration.
2021-05-31Version bump.Maxim Dounin1-2/+2
2021-05-25Resolver: explicit check for compression pointers in question.Maxim Dounin1-0/+6
Since nginx always uses exactly one entry in the question section of a DNS query, and never uses compression pointers in this entry, parsing of a DNS response in ngx_resolver_process_response() does not expect compression pointers to appear in the question section of the DNS response. Indeed, compression pointers in the first name of a DNS response hardly make sense, do not seem to be allowed by RFC 1035 (which says "a pointer to a prior occurance of the same name", note "prior"), and were never observed in practice. Added an explicit check to ngx_resolver_process_response()'s parsing of the question section to properly report an error if compression pointers nevertheless appear in the question section.
2021-05-25Resolver: simplified ngx_resolver_copy().Maxim Dounin1-8/+5
Instead of checking on each label if we need to place a dot or not, now it always adds a dot after a label, and reduces the resulting length afterwards.
2021-05-25Resolver: reworked ngx_resolver_copy() copy loop.Maxim Dounin1-11/+7
To make the code easier to read, reworked the ngx_resolver_copy() copy loop to match the one used to calculate length. No functional changes.
2021-05-25Resolver: fixed label types handling in ngx_resolver_copy().Maxim Dounin1-0/+5
Previously, anything with any of the two high bits set were interpreted as compression pointers. This is incorrect, as RFC 1035 clearly states that "The 10 and 01 combinations are reserved for future use". Further, the 01 combination is actually allocated for EDNS extended label type (see RFC 2671 and RFC 6891), not really used though. Fix is to reject unrecognized label types rather than misinterpreting them as compression pointers.
2021-05-25Resolver: fixed off-by-one read in ngx_resolver_copy().Maxim Dounin1-0/+5
It is believed to be harmless, and in the worst case it uses some uninitialized memory as a part of the compression pointer length, eventually leading to the "name is out of DNS response" error.
2021-05-25Resolver: fixed off-by-one write in ngx_resolver_copy().Maxim Dounin1-4/+4
Reported by Luis Merino, Markus Vervier, Eric Sesterhenn, X41 D-Sec GmbH.
2021-05-19Core: fixed comment about msie_refresh escaping.Ruslan Ermilov1-1/+1
After 12a656452ad1, the "%" character is no longer escaped by ngx_escape_uri(NGX_ESCAPE_REFRESH).
2021-04-21Version bump.Maxim Dounin1-2/+2
2021-04-08Introduced the "keepalive_time" directive.Maxim Dounin2-0/+5
Similar to lingering_time, it limits total connection lifetime before keepalive is switched off. The default is 1 hour, which is close to the total maximum connection lifetime possible with default keepalive_requests and keepalive_timeout.
2021-04-05Version bump.Maxim Dounin1-2/+2
2021-03-28Resolver: added missing event handling after reading.Maxim Dounin1-2/+17
If we need to be notified about further events, ngx_handle_read_event() needs to be called after a read event is processed. Without this, an event can be removed from the kernel and won't be reported again, notably when using oneshot event methods, such as eventport on Solaris. While here, error handling is also added, similar to one present in ngx_resolver_tcp_read(). This is not expected to make a difference and mostly added for consistency.
2021-03-11Version bump.Maxim Dounin1-2/+2
2021-02-20Version bump.Ruslan Ermilov1-2/+2
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