Commit Graph
100 Commits
Author SHA1 Message Date
Vladimir Homutov 8b92710728 Core: added the ngx_rbtree_data() macro. 2021-06-21 09:42:43 +03:00
Vladimir Homutov 3c04273733 Core: added format specifiers to output binary data as hex.
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-10-28 10:56:11 +03:00
Vladimir Homutov c566d79993 Version bump. 2020-11-05 22:37:27 +03:00
Vladimir Homutov 58d1412f0d Stream: fixed processing of zero length UDP packets (ticket #1982). 2020-06-08 11:40:34 +03:00
Vladimir Homutov de5a054b33 Made ngx_http_get_forwarded_addr_internal() non-recursive. 2020-02-11 13:22:44 +03:00
Vladimir Homutov 0e3b3b5735 gRPC: variables support in the "grpc_pass" directive. 2020-01-17 12:13:02 +03:00
Vladimir Homutov f7999fe689 Core: removed dead code in ngx_rbtree_delete().
The result of ngx_rbtree_min() is always a node with the left child equal to
sentinel, thus the check is unnecessary.
2019-09-30 16:39:20 +03:00
Vladimir Homutov 201062c83f Version bump. 2019-09-30 16:43:16 +03:00
Vladimir Homutov 2eb2a93d8a Core: enabled "include" in any context (ticket #1615). 2019-04-09 11:40:20 +03:00
Vladimir Homutov 68b147535a Version bump. 2019-04-24 13:41:29 +03:00
Vladimir Homutov b6b39b2fb9 Added the ngx_http_test_required_predicates() function.
In contrast to ngx_http_test_predicates(), it requires all values to be
non-empty and not equal to "0".
2019-01-17 14:31:04 +03:00
Vladimir Homutov de20d73ec5 Version bump. 2019-01-17 14:31:01 +03:00
Vladimir Homutov 910f330ad0 Autoindex: fixed possible integer overflow on 32-bit systems. 2018-12-25 12:59:24 +03:00
Vladimir Homutov c241467318 Upstream: revised upstream response time variables.
Variables now do not depend on presence of the HTTP status code in response.
If the corresponding event occurred, variables contain time between request
creation and the event, and "-" otherwise.

Previously, intermediate value of the $upstream_response_time variable held
unix timestamp.
2018-11-21 13:40:40 +03:00
Vladimir Homutov 0f669b23a8 Upstream: removed unused ngx_http_upstream_t.timeout field. 2018-11-21 13:40:36 +03:00
Vladimir Homutov 41a451e286 Stream: proxy_requests directive.
The directive allows to drop binding between a client and existing UDP stream
session after receiving a specified number of packets.  First packet from the
same client address and port will start a new session.  Old session continues
to exist and will terminate at moment defined by configuration: either after
receiving the expected number of responses, or after timeout, as specified by
the "proxy_responses" and/or "proxy_timeout" directives.

By default, proxy_requests is zero (disabled).
2018-11-12 16:29:30 +03:00
Vladimir Homutov abf04ed87a Stream: session completion check code moved to a separate function.
The code refactored to simplify the ngx_stream_proxy_process() function
and facilitate adding new session termination conditions.
2018-11-12 12:05:03 +03:00
Vladimir Homutov 7e3041b79f Stream: fixed possible use of a freed connection.
The session handler may result in session termination, thus a connection
pool (from which c->udp was allocated) may be destroyed.
2018-11-07 13:22:14 +03:00
Vladimir Homutov 6351d8306f Version bump. 2018-11-13 14:42:47 +03:00
Vladimir Homutov 1305b8414d Upstream: proxy_socket_keepalive and friends.
The directives enable the use of the SO_KEEPALIVE option on
upstream connections.  By default, the value is left unchanged.
2018-10-03 14:08:51 +03:00
Vladimir Homutov ae1e6e5ec0 Version bump. 2018-10-03 17:02:44 +03:00
Vladimir Homutov 62821f1c99 Upstream: fixed request chain traversal (ticket #1618).
The problem does not manifest itself currently, because in case of
non-buffered reading, chain link created by u->create_request method
consists of a single element.

Found by PVS-Studio.
2018-08-24 12:19:37 +03:00
Vladimir Homutov 0c4ccbea23 Upstream: ngx_http_upstream_random module.
The module implements random load-balancing algorithm with optional second
choice.  In the latter case, the best of two servers is chosen, accounting
number of connections and server weight.

Example:

upstream u {
    random [two [least_conn]];

    server 127.0.0.1:8080;
    server 127.0.0.1:8081;
    server 127.0.0.1:8082;
    server 127.0.0.1:8083;
}
2018-06-15 11:46:14 +03:00
Vladimir Homutov 5568a6598d Syslog: install cleanup handler only once.
If a socket was re-opened due to an error (02c2352d5b01 and fa0e093b64d7),
additional cleanup handler was installed each time.
2018-05-14 22:50:57 +03:00
Vladimir Homutov 644d26e841 Syslog: re-open syslog udp socket on send error (ticket #1477).
Previously, only unix domain sockets were reopened to tolerate cases when
local syslog server was restarted.  It makes sense to treat other cases
(for example, local IP address changes) similarly.
2018-05-08 19:35:56 +03:00
Vladimir Homutov cadc8ca306 Core: fixed build, broken by 63e91f263a49.
Both Solaris and Windows define "s_addr" as a macro.
2018-04-02 20:38:43 +03:00
Vladimir Homutov ecd6e243b6 Core: style. 2018-03-27 18:39:38 +03:00
Vladimir Homutov 9207cc84b2 Core: added processing of version 2 of the PROXY protocol.
The protocol used on inbound connection is auto-detected and corresponding
parser is used to extract passed addresses.  TLV parameters are ignored.

The maximum supported size of PROXY protocol header is 107 bytes
(similar to version 1).
2018-03-22 15:55:28 +03:00
Vladimir Homutov 7647372565 Access log: support for disabling escaping (ticket #1450).
Based on patches by Johannes Baiter <johannes.baiter@bsb-muenchen.de>
and Calin Don.
2018-03-01 11:42:55 +03:00
Vladimir Homutov 2d9db482aa Modules compatibility: additional upstream metrics. 2018-02-22 17:25:43 +03:00
Vladimir Homutov 9d00f9e449 Core: added a stub for additional zone configuration. 2018-02-15 16:08:05 +03:00
Vladimir Homutov a965e1d766 Mail: configurable socket buffer sizes.
The "rcvbuf" and "sndbuf" parameters are now supported by
the "listen" directive.
2017-04-03 17:30:34 +03:00
Vladimir Homutov 9f7b557673 Stream: configurable socket buffer sizes.
The "rcvbuf" and "sndbuf" parameters are now supported by
the "listen" directive.
2017-04-03 17:29:19 +03:00
Vladimir Homutov 20443cae62 Upstream: removed compatibility shims from ngx_http_upstream_t.
The type is no longer modified in NGINX Plus.
2017-01-25 15:39:22 +03:00
Vladimir Homutov dbb698363b Version bump. 2017-01-26 11:44:55 +03:00
Vladimir Homutov 620c9a4c44 Stream: client SSL certificates were not checked in some cases.
If ngx_stream_ssl_init_connection() succeeded immediately, the check was not
done.

The bug had appeared in 1.11.8 (41cb1b64561d).
2017-01-19 16:20:07 +03:00
Vladimir Homutov 0ccbe0abe4 Stream: fixed handling of non-ssl sessions.
A missing check could cause ngx_stream_ssl_handler() to be applied
to a non-ssl session, which resulted in a null pointer dereference
if ssl_verify_client is enabled.

The bug had appeared in 1.11.8 (41cb1b64561d).
2017-01-19 16:17:05 +03:00
Vladimir Homutov b580770f3a Stream: avoid infinite loop in case of socket read error. 2017-01-11 12:01:56 +03:00
Vladimir Homutov 7fab8d046e Stream: client SSL certificates verification support.
New directives: "ssl_verify_client", "ssl_verify_depth",
"ssl_client_certificate", "ssl_trusted_certificate", and
"ssl_crl".

New variables: $ssl_client_cert, $ssl_client_raw_cert,
$ssl_client_s_dn, $ssl_client_i_dn, $ssl_client_serial,
$ssl_client_fingerprint, $ssl_client_verify, $ssl_client_v_start,
$ssl_client_v_end, and $ssl_client_v_remain.
2016-12-20 12:05:14 +03:00
Vladimir Homutov 33f940534e Core: show file contents only once while dumping configuration.
Files are considered the same if the path used by nginx during parsing matches.
2016-10-18 16:33:38 +03:00
Vladimir Homutov f8a9d528df Upstream hash: fixed missing upstream name initialization. 2016-09-16 15:13:24 +03:00
Vladimir Homutov 7f57804fe2 Stream ssl_preread: removed internal macro.
The ngx_log_debug() macro is internal and should not be used.
2016-09-15 15:36:02 +03:00
Vladimir Homutov 5a7afb1b0d Stream: ssl_preread module.
The ssl_preread module extracts information from the SSL Client Hello message
without terminating SSL.  Currently, only $ssl_preread_server_name variable
is supported, which contains server name from the SNI extension.
2016-09-15 14:56:51 +03:00
Vladimir Homutov 704446127e Stream: preread phase.
In this phase, head of a stream is read and analysed before proceeding to the
content phase.  Amount of data read is controlled by the module implementing
the phase, but not more than defined by the "preread_buffer_size" directive.
The time spent on processing preread is controlled by the "preread_timeout"
directive.

The typical preread phase module will parse the beginning of a stream and set
variable that may be used by the content phase, for example to make routing
decision.
2016-09-15 14:56:02 +03:00
Vladimir Homutov afa771140b Version bump. 2016-09-15 14:56:26 +03:00
Vladimir Homutov 68a7b9b5a3 Stream: log module. 2016-09-05 17:50:16 +03:00
Vladimir Homutov 443b52db59 Stream: upstream response time variables.
The $upstream_connect_time, $upstream_first_byte_time and
$upstream_session_time variables keep corresponding times.
2016-09-02 18:27:12 +03:00
Vladimir Homutov 64223df670 Stream: $upstream_bytes_sent and $upstream_bytes_received. 2016-09-02 18:27:08 +03:00
Vladimir Homutov c6d456da87 Stream: the $upstream_addr variable.
Keeps the full address of the upstream server.  If several servers were
contacted during proxying, their addresses are separated by commas,
e.g. "192.168.1.1:80, 192.168.1.2:80".
2016-09-02 18:27:05 +03:00
Vladimir Homutov 048ee94130 Stream: the $protocol variable.
The variable keeps protocol used by the client, "TCP" or "UDP".
2016-08-26 15:33:07 +03:00
Vladimir Homutov f04b65358e Stream: the $session_time variable.
The variable keeps time spent on processing the stream session.
2016-08-26 15:33:04 +03:00
Vladimir Homutov 1258126f0c Stream: the $bytes_received variable.
The variable keeps the number of bytes received from the client.
2016-08-26 15:33:02 +03:00
Vladimir Homutov 50ba1a2cde Upstream: the $upstream_bytes_received variable.
Unlike $upstream_response_length that only counts the body size,
the new variable also counts the size of response header and data
received after switching protocols when proxying WebSockets.
2016-08-10 16:46:39 +03:00
Vladimir Homutov 38ca99cf98 Stream: fixed build without stream_ssl_module (ticket #1032). 2016-07-26 19:34:12 +03:00
Vladimir Homutov 386e3e80bb Version bump. 2016-07-26 19:07:18 +03:00
Vladimir Homutov 161fcf4bdd Fixed regex captures handling without PCRE.
If PCRE is disabled, captures were treated as normal variables in
ngx_http_script_compile(), while code calculating flushes array length in
ngx_http_compile_complex_value() did not account captures as variables.
This could lead to write outside of the array boundary when setting
last element to -1.

Found with AddressSanitizer.
2016-07-06 14:33:40 +03:00
Vladimir Homutov 74305af672 Stream: variables in proxy_pass and proxy_ssl_name. 2016-06-14 18:29:46 +03:00
Vladimir Homutov 6c2b086d0e Stream: split_clients module. 2016-07-12 17:34:52 +03:00
Vladimir Homutov bb790f5d30 Stream: geo module. 2016-06-30 16:12:50 +03:00
Vladimir Homutov 4cf0e28483 Stream: geoip module. 2016-07-12 17:34:43 +03:00
Vladimir Homutov e1308338a9 Stream: style. 2016-07-12 17:34:40 +03:00
Vladimir Homutov 4105225310 Stream: individual build options for modules. 2016-07-12 12:38:01 +03:00
Vladimir Homutov dea1e999b8 Stream: resolver. 2016-07-07 13:15:31 +03:00
Vladimir Homutov 9721eae1f1 Stream: SSL-related variables. 2016-06-29 12:52:52 +03:00
Vladimir Homutov cb635b7879 Stream: got rid of pseudo variables.
Stream limit_conn, upstream_hash and proxy modules now use complex values.
2016-06-29 12:46:12 +03:00
Vladimir Homutov 05db6ddfa1 Stream: map module. 2016-06-29 12:46:12 +03:00
Vladimir Homutov d531cebb79 Stream: core module variables. 2016-06-14 18:28:14 +03:00
Vladimir Homutov c31773ea60 Stream: variables and script.
This is a port of corresponding http code with unrelated features excluded.
2016-07-04 16:37:36 +03:00
Vladimir Homutov db5a15d2f9 Stream: added preconfiguration step. 2016-06-15 15:10:24 +03:00
Vladimir Homutov f315b7a924 Variable $request_id.
The variable contains text representation based on random data, usable as
a unique request identifier.
2016-04-26 19:31:46 +03:00
Vladimir Homutov 818ebb3492 Stream: additional logging for UDP. 2016-03-18 19:53:22 +03:00
Vladimir Homutov faa96e82d2 Core: added support for more than 64 CPUs in worker_cpu_affinity. 2016-02-18 13:58:49 +03:00
Vladimir Homutov e7d298f3fc Syslog: added "nohostname" option.
The option disables sending hostname in the syslog message header.  This is
useful with syslog daemons that do not expect it (tickets #677 and #783).
2015-10-26 19:06:42 +03:00
Vladimir Homutov 645697f111 SSL: handled long string truncation in ngx_ssl_error().
If no space left in buffer after adding formatting symbols, error message
could be left without terminating null.  The fix is to output message using
actual length.
2015-10-07 22:19:42 +03:00
Vladimir Homutov f2d31f8291 Stream: fixed potential error log buffer overrun.
Found by Duan Jiong <djduanjiong@gmail.com>.
2015-08-13 15:55:21 +03:00
Vladimir Homutov 75dcdc2269 Style. 2015-08-12 12:56:59 +03:00
Vladimir Homutov b537def75e Stream: the "tcp_nodelay" directive. 2015-08-10 12:14:41 +03:00
Vladimir Homutov 14ff3d4f87 Stream: connection limiting module.
stream {
    limit_conn_zone $binary_remote_addr zone=perip:1m;
    limit_conn_log_level error;

    server {
        ...
        limit_conn perip 1;
    }
}
2015-06-18 14:17:30 +03:00
Vladimir Homutov b7a8f2a08f Disabled duplicate http, mail, and stream blocks.
Such configurations have very limited use, introduce various problems and
are not officially supported.
2015-06-16 23:28:38 +03:00
Vladimir Homutov 9efe6c2243 Version bump. 2015-06-16 23:31:31 +03:00
Vladimir Homutov 9bd637659a Documentation: added -T option description to the man page. 2015-06-16 16:28:56 +03:00
Vladimir Homutov 4e83d3f7b5 Core: store and dump processed configuration.
If the -T option is passed, additionally to configuration test, configuration
files are output to stdout.

In the debug mode, configuration files are kept in memory and can be accessed
using a debugger.
2015-05-14 18:54:27 +03:00
Vladimir Homutov 42c32b733b Core: added support for writing to stdout. 2015-06-16 15:47:40 +03:00
Vladimir Homutov f50f83a2cf Stream: the "proxy_bind" directive. 2015-06-16 09:02:45 +03:00
Vladimir Homutov 8ab1aa612d Stream: access module.
stream {
    server {
        ...
        allow 127.0.0.1;
        deny all;
    }
}
2015-06-04 13:04:12 +03:00
Vladimir Homutov d56b84b783 Stream: added postconfiguration method to stream modules. 2015-06-09 13:00:45 +03:00
Vladimir Homutov 4e010c2834 Mail: error_log support. 2015-02-20 15:31:37 +03:00
Vladimir Homutov df555ffce6 Core: the ngx_set_connection_log() macro.
The http and stream versions of this macro were identical.
2015-04-25 22:44:02 +03:00
Vladimir Homutov fd4da89228 Core: added OpenSSL version information to "nginx -V" output. 2015-04-16 12:17:41 +03:00
Vladimir Homutov 513f184098 Version bump. 2015-04-16 12:13:51 +03:00
Vladimir Homutov 7e1eba5faa Upstream: $upstream_header_time variable.
Keeps time spent on obtaining the header from an upstream server.  The value is
formatted similar to the $upstream_response_time variable.
2015-01-14 09:03:35 +03:00
Vladimir Homutov 742b5dd045 Syslog: allowed underscore symbol in tag (ticket #667). 2014-11-20 20:02:21 +03:00
Vladimir Homutov 27fa3123f9 Syslog: improved error handling of unix domain sockets.
If a syslog daemon is restarted and the unix socket is used, further logging
might stop to work.  In case of send error, socket is closed, forcing
a reconnection at the next logging attempt.
2014-08-26 14:56:54 +04:00
Vladimir Homutov d79cbf15e6 Syslog: enabled logging of send errors.
The ngx_cycle->log is used when sending the message.  This allows to log syslog
send errors in another log.

Logging to syslog after its cleanup handler has been executed was prohibited.
Previously, this was possible from ngx_destroy_pool(), which resulted in error
messages caused by attempts to write into the closed socket.

The "processing" flag is renamed to "busy" to better match its semantics.
2014-09-01 17:55:07 +04:00
Vladimir Homutov c54899ddfd Core: fixed default log initialization.
The ngx_log_insert() function may invalidate pointer passed to it,
so make sure to don't use it after the ngx_log_insert() call.
2014-07-24 16:25:07 +04:00
Vladimir Homutov 21655ae097 Syslog: fixed message sending on win32. 2014-05-27 15:42:34 +04:00
Vladimir Homutov 8e82f06d3e Syslog: fixed possible resource leak and more verbose logging.
Found by Coverity (CID 1215646).
2014-05-26 23:34:44 +04:00
Vladimir Homutov 493b898ae9 Added syslog support for error_log and access_log directives. 2014-05-12 16:34:15 +04:00
Vladimir Homutov ed6780aaf1 Upstream: added the "$upstream_cookie_<name>" variables. 2014-04-29 12:28:41 +04:00
Vladimir Homutov 8d97a2e4d7 Fixed false compiler warning.
Newer gcc versions (4.7+) report possible use of uninitialized variable if
nginx is being compiled with -O3.
2014-01-31 14:18:52 +04:00