Commit Graph
100 Commits
Author SHA1 Message Date
Valentin Bartenev 62d173f7af Fixed possible access to an uninitialized field.
The "recv_msg.incoming_buf" is checked after jumping to the "done" label
if nxt_socket_msg_oob_get_fds() returns an error.

Also moved initialization of "port_msg" near to its first usage.

Found by Coverity (CID 373899).
2021-11-23 15:36:24 +03:00
Valentin Bartenev f30f8f06c9 Version bump. 2021-12-02 17:16:05 +03:00
Valentin Bartenev b77895d1c7 Unit 1.26.0 release. 2021-11-18 17:00:01 +03:00
Valentin Bartenev 3f9d587269 Generated Dockerfiles for Unit 1.26.0. 2021-11-18 15:48:02 +03:00
Valentin Bartenev 0eaeb65edb Added version 1.26.0 CHANGES. 2021-11-18 15:48:02 +03:00
Valentin Bartenev 9b1dcc4aa6 Reordered changes for 1.26.0 by significance (subjective). 2021-11-18 15:48:02 +03:00
Valentin Bartenev aed1c55a06 Removed the execute permission bit from "nxt_h1proto.c".
It was accidentally added in 4645a43bc248.
2021-11-11 18:54:10 +03:00
Valentin Bartenev b6f4b3afb1 Improved logging of app module load errors. 2021-11-02 17:34:23 +03:00
Valentin Bartenev 1441f42b5d Fixed memleaks if PID checks fail in nxt_port_incoming_port_mmap().
Memory allocated for "mem" and "mmap_handler" leaked in that case.
Also removed one dead assigment of "hdr" pointer.
2021-10-27 20:37:34 +03:00
Valentin Bartenev 561dbeb98d Fixed a potential descriptor leak if mmap() failed. 2021-10-26 19:31:43 +03:00
Valentin Bartenev 7bf6253941 Custom implementation of Base64 decoding function.
Compared to the previous implementation based on OpenSSL, the new implementation
has these advantages:

 1. Strict and reliable detection of invalid strings, including strings with
    less than 4 bytes of garbage at the end;

 2. Allows to use Base64 strings without '=' padding.
2021-10-26 15:43:44 +03:00
Valentin Bartenev 8db8330f84 Static: removed surplus assignment.
It's not needed after 69d823e5710a.
Found by Clang Static Analyzer.
2021-10-04 15:33:56 +03:00
Valentin Bartenev 9baf22e7bf Static: fixed possible descriptor leak introduced in a946d8cd7f8c. 2021-10-04 15:33:04 +03:00
Valentin Bartenev dbc5a742fd TLS: refactored nxt_tls_ticket_key_callback().
Deduplicated code and improved style.
No functional changes.
2021-08-25 10:33:32 +03:00
Valentin Bartenev f50b07c21d Version bump. 2021-08-24 14:38:24 +03:00
Valentin Bartenev 13c0025dfa Unit 1.25.0 release. 2021-08-19 17:55:12 +03:00
Valentin Bartenev 66e986fc19 Generated Dockerfiles for Unit 1.25.0. 2021-08-19 17:52:54 +03:00
Valentin Bartenev 9aefc73476 Added version 1.25.0 CHANGES. 2021-08-19 17:48:21 +03:00
Valentin Bartenev 90680c2caf Reordered changes for 1.25.0 by significance (subjective). 2021-08-19 17:43:04 +03:00
Valentin Bartenev 38ac7de61e Version bump. 2021-05-28 18:16:23 +03:00
Valentin Bartenev d06e55dfa3 Unit 1.24.0 release. 2021-05-27 16:59:54 +03:00
Valentin Bartenev 25d8e102b0 Generated Dockerfiles for Unit 1.24.0. 2021-05-27 16:07:15 +03:00
Valentin Bartenev 340955a75f Added version 1.24.0 CHANGES. 2021-05-27 16:06:01 +03:00
Valentin Bartenev ff15f25839 Reordered changes for 1.24.0 by significance (subjective). 2021-05-27 16:05:42 +03:00
Valentin Bartenev 539551c89f PHP: adopted "file_handle" to Zend API changes in 8.1.0-dev.
This fixes building module with the development version of PHP after the change:
https://github.com/php/php-src/commit/c732ab400af92c54eee47c487a56009f1d79dd5d
2021-05-21 14:41:35 +03:00
Valentin Bartenev b0e32bc015 PHP: forced initialization of $_SERVER in fastcgi_finish_request().
The "auto_globals_jit" PHP option postponed the initialization of the $_SERVER
global variable until the script using it had been loaded (e. g. via the
"include" expression).  As a result, nxt_php_register_variables() could be
called after fastcgi_finish_request() had finished the request and nulled
ctx->req, which thus caused a segmentation fault.
2021-05-07 07:46:25 +03:00
Valentin Bartenev a5eca0b83f Packages: fixed "dist" target to include man page in the archive. 2021-03-31 18:39:42 +03:00
Valentin Bartenev 1ef72a79fe Version bump. 2021-03-26 11:29:41 +03:00
Valentin Bartenev 3c969905bd Added tag 1.23.0 for changeset 49ee24c03f57 2021-03-25 17:25:18 +03:00
Valentin Bartenev 71d3700951 Generated Dockerfiles for Unit 1.23.0. 2021-03-25 17:15:30 +03:00
Valentin Bartenev 6ecc9e8198 Added version 1.23.0 CHANGES. 2021-03-25 17:14:27 +03:00
Valentin Bartenev 067c6096e2 Node.js: used distinct placeholder for version in "package.json".
This makes the "sed" instruction simpler and more portable, as the previous
variant didn't work well on BSD systems due to the "\s" metacharacter.

Thanks to Sergey A. Osokin <osa@FreeBSD.org.ru> for spotting this issue.

Also, this should prevent accidentally creating a version 1.0.0 package.
2021-03-25 16:15:03 +03:00
Valentin Bartenev 699a3ea2eb Certificates: fixed in name attributes processing.
The idea is to put SAN after CN, but the previous version of the code
incorrectly assumed that CN was always present, which caused writes
outside the allocated object if there were no standard name attributes.
2021-03-24 16:55:47 +03:00
Valentin Bartenev a6c6dcf5f7 Certificates: moved SAN processing to a separate function.
No functional changes.
2021-03-24 16:38:05 +03:00
Valentin Bartenev f18a41c84b Certficates: fixed counting DNS SAN entries.
Previously, entries of any type were counted during object allocation
but only DNS type entries were actually processed.  As a result,
if some certificate entries had another type, returning information
about the certificate caused uninitialized memory access.
2021-03-24 16:38:05 +03:00
Valentin Bartenev b04832da84 Disabled logging alerts to syslog.
It feels to be causing more harm than good, because syslog() can be blocking,
which is even more critical under resource exhaustion conditions when some
alerts are expected.
2021-03-24 08:05:07 +03:00
Valentin Bartenev 99337728ed Fixed building the PHP 5 module with ZTS, broken by dab8544b5440.
This closes #525 issue on GitHub.
2021-03-15 15:03:32 +03:00
Valentin Bartenev 4c261a7ff8 Ruby: fixed encodings initialization.
The Ruby interpreter expects an explicit setlocale() call before initialization
to pick up character encodings in the "Encoding" class from the environment.

This closes #531 issue on GitHub.
2021-03-15 15:03:32 +03:00
Valentin Bartenev b0a1266835 Fixed certificates loading on startup with some filesystems.
It appears that readdir() on Linux detects file types unreliably, always setting
the "d_type" field to DT_UNKNOWN for some less common filesystems.  As a result,
all files were skipped and no certificate bundles were found when the state
directory was located on such filesystems.

Skipping "." and ".." instead of any non-regular files should be enough, as no
other non-regular files normally appear in this directory.

This closes #368 issue on GitHub.
2021-03-15 14:57:31 +03:00
Valentin Bartenev a1107e859b Fixed TLS connection shutdown on errors.
An immediate return statement on connection errors was mistakenly added to the
beginning of nxt_openssl_conn_io_shutdown() in ecd3c5bbf7d8, breaking the TLS
connection finalization procedure.  As a result, a TLS connection was left
unfinalized if it had been closed prematurely or a fatal protocol error had
occurred, which caused memory and socket descriptor leakage.

Moreover, in some cases (notably, on handshake errors in tests with kqueue on
macOS) the read event was triggered later and nxt_h1p_conn_error() was called
the second time; after the change in af93c866b4f0, the latter call crashed the
router process in an attempt to remove a connection from the idle queue twice.
2021-03-15 14:57:01 +03:00
Valentin Bartenev ecd0fc5d81 Version bump. 2021-02-16 18:54:00 +03:00
Valentin Bartenev 774a6034d9 Added tag 1.22.0 for changeset 331bdadeca30 2021-02-04 18:29:31 +03:00
Valentin Bartenev 98228f8ac8 Generated Dockerfiles for Unit 1.22.0. 2021-02-04 18:22:33 +03:00
Valentin Bartenev 56626b9232 Added version 1.22.0 CHANGES. 2021-02-04 18:22:33 +03:00
Valentin Bartenev bde6a2afd4 Reordered changes for 1.22.0 by significance (subjective). 2021-02-04 18:22:33 +03:00
Valentin Bartenev 93ac087e96 Fixed building by GCC 10 with -flto and -O2.
This closes #467 issue on GitHub.
2021-02-01 18:55:49 +03:00
Valentin Bartenev 0ddbc00d7d Fixed changelog style. 2021-01-28 19:22:17 +03:00
Valentin Bartenev 6e28263d65 Bumping year in copyright notice. 2021-01-18 16:48:47 +03:00
Valentin Bartenev cac762ab7e Python: multiple values in the "path" option. 2020-12-22 17:53:41 +03:00
Valentin Bartenev 8d65a3303b Python: WSGI environment copying moved out of request processing.
The WSGI environment dictionary contains a number of static items, that are
pre-initialized on application start.  Then it's copied for each request to be
filled with request-related data.

Now this dictionary copy operation will be done between processing of requests,
which should save some CPU cycles during request processing and thus reduce
response latency for non-peak load periods.
2020-12-14 17:15:49 +03:00
Valentin Bartenev 2348229dc7 PHP: populating PHP_AUTH_* server variables.
This closes #498 issue on GitHub.
2020-12-08 01:59:46 +03:00
Valentin Bartenev bda76b04e9 HTTP: fixed status line format for unknown status codes.
According to Section #3.1.2 of RFC 7230, after the status code
there must be a space even if the reason phrase is empty.

Also, only 3 digits allowed.

This closes #507 issue on GitHub.
2020-12-07 18:50:56 +03:00
Valentin Bartenev 956fce6614 Libunit: improved error logging around initialization env variable. 2020-11-24 16:40:35 +03:00
Valentin Bartenev 35178dbb06 Version bump. 2020-11-24 16:40:28 +03:00
Valentin Bartenev 806a9b2515 Added tag 1.21.0 for changeset f804aaf7eee1 2020-11-19 21:13:19 +03:00
Valentin Bartenev 9e85732e9a Generated Dockerfiles for Unit 1.21.0. 2020-11-19 21:12:30 +03:00
Valentin Bartenev fa1a3298ef Added version 1.21.0 CHANGES. 2020-11-19 19:59:18 +03:00
Valentin Bartenev fb80502513 HTTP parser: allowed more characters in header field names.
Previously, all requests that contained in header field names characters other
than alphanumeric, or "-", or "_" were rejected with a 400 "Bad Request" error
response.

Now, the parser allows the same set of characters as specified in RFC 7230,
including: "!", "#", "$", "%", "&", "'", "*", "+", ".", "^", "`", "|", and "~".
Header field names that contain only these characters are considered valid.

Also, there's a new option introduced: "discard_unsafe_fields".  It accepts
boolean value and it is set to "true" by default.

When this option is "true", all header field names that contain characters
in valid range, but other than alphanumeric or "-" are skipped during parsing.
When the option is "false", these header fields aren't skipped.

Requests with non-valid characters in header field names according to
RFC 7230 are rejected regardless of "discard_unsafe_fields" setting.

This closes #422 issue on GitHub.
2020-11-17 16:50:06 +03:00
Valentin Bartenev e30db59168 PHP: implementation of the fastcgi_finish_request() function.
This closes #219 issue on GitHub.
2020-11-11 12:09:54 +03:00
Valentin Bartenev cb28b41311 PHP: prevention of consuming unread request body on finalization.
The php_request_shutdown() function calls sapi_deactivate() that tries to read
request body into a dummy buffer.  In our case it's just waste of CPU cycles.

This change is also required for the following implementation of the
fastcgi_finish_request() function, where the request context can be
cleared by the time of finalization.
2020-11-11 12:09:49 +03:00
Valentin Bartenev d03b217f33 Fixed building test app without debug.
Compilers complained about unused variables after 37e2a3ea1bf1.
2020-11-01 13:22:11 +03:00
Valentin Bartenev 50af47fd7c Isolation: fixed passing custom options to nmount().
The "iov" array was filled incorrectly when custom mounting options were set.
2020-10-30 07:55:26 +03:00
Valentin Bartenev 434c3228d9 Increased request memory pool size.
Previous value was too small, which reduced efficiency of the pool causing
a lot of additional allocations even for simple request and response.
2020-10-26 22:26:02 +03:00
Valentin Bartenev 84136eb49d Configure: using comma instead of space for passing -rpath value.
This variant will be more interoperable across various systems
and it's already used in Ruby module.

Otherwise, configure tests fail on NetBSD with:

  gcc: Missing argument for -Wl,-rpath
2020-10-26 22:24:32 +03:00
Valentin Bartenev 0919166145 Fixed building with Python 3.9.
PyUnicode_GET_SIZE() in deprecated since 3.3 and will be removed in 3.12.
In version 3.9 it was explicitly marked by deprecation warning causing
compilation error with Unit.

PyUnicode_GET_LENGTH() must be used instead.
2020-10-13 01:37:39 +03:00
Valentin Bartenev c4f2a58aaf Version bump. 2020-10-13 01:37:39 +03:00
Valentin Bartenev ad516735a6 Adjusted tag 1.20.0 to include 0e985b300673. 2020-10-08 19:09:16 +03:00
Valentin Bartenev 7d77d50568 Updated 1.20.0 CHANGES to include pytest migration. 2020-10-08 19:04:40 +03:00
Valentin Bartenev 10468ed22b Added tag 1.20.0 for changeset f7e9cf490512 2020-10-08 18:55:50 +03:00
Valentin Bartenev 03d965b49c Generated Dockerfiles for Unit 1.20.0. 2020-10-08 18:32:48 +03:00
Valentin Bartenev f221ddbe66 Added version 1.20.0 CHANGES. 2020-10-08 18:32:36 +03:00
Valentin Bartenev 2821b3347c PHP: compatibility with 8.0.0 RC1.
This closes #474 PR on GitHub.
2020-10-06 18:12:05 +03:00
Valentin Bartenev 645683f432 Tests: fixed loading selected module version.
Previously, for PHP, Ruby, and Perl the latest version was always loaded
in multi-version tests.
2020-10-07 22:04:54 +03:00
Valentin Bartenev 3f513f434f Router: fixed "not empty" pattern matching.
The "!" pattern should be opposite to "", i.e. match only non-empty values.
But after 3c00af54b937 it was equal to "!*", which is wrong.
2020-10-07 20:06:30 +03:00
Valentin Bartenev 67d33fac66 MIME: added AVIF and APNG image formats.
AVIF is a modern image format based on the AV1 video codec.  It generally has
better compression than other widely used formats (WebP, JPEG, PNG, and GIF)
and is designed to supersede them.  Support was already added to the latest
version of Chrome.

APNG extends PNG to permit animated images that work similarly to animated GIF.
It's supported by most modern browsers.

Also removed duplicated ".svg" entry.
2020-09-29 23:23:32 +03:00
Valentin Bartenev 70c2a4645e Vars: added $host.
This closes #407 issue on GitHub.
2020-08-28 19:34:49 +03:00
Valentin Bartenev dcfa92c161 Configuration: removed "reschedule_timeout" option.
It's not used since cbcd76704c90.

This option is a leftover from previous IPC between router and applications
processes.  It was never documented, though.

Thanks to 洪志道 (Hong Zhi Dao).
2020-08-21 20:50:04 +03:00
Valentin Bartenev 9bf6efc55a Configuration: improved error message of invalid listener address.
Thanks to 洪志道 (Hong Zhi Dao).
This closes #466 issue on GitHub.
2020-08-19 15:36:57 +03:00
Valentin Bartenev a13018fecb Version bump. 2020-08-17 11:57:55 +03:00
Valentin Bartenev 6473d4b65a Added tag 1.19.0 for changeset 86cdf66f8274 2020-08-13 19:22:57 +03:00
Valentin Bartenev ba445d31f1 Generated Dockerfiles for Unit 1.19.0. 2020-08-13 19:22:41 +03:00
Valentin Bartenev b8c7bc5a47 Added version 1.19.0 CHANGES. 2020-08-13 19:22:41 +03:00
Valentin Bartenev a58f224e26 Fixed typo in return value check.
Found by Coverity (CID 361277).
2020-08-13 03:45:54 +03:00
Valentin Bartenev 93146616cf Basic variables support. 2020-08-13 02:46:54 +03:00
Valentin Bartenev 91280b4c0b Ruby: fixed gem mount paths.
The gem paths must depend on the specified interpreter.
Also, gemdir looks redundant as it's already included in Gem.default_path().
2020-08-09 01:00:44 +03:00
Valentin Bartenev 317fabc83e Ruby: simplified commands in ./configure script.
There is no reason to use printf instead of just print.

No functional changes.
2020-08-09 01:00:44 +03:00
Valentin Bartenev 7e1d800f08 Ruby: removed unused variable from ./configure script. 2020-08-09 01:00:44 +03:00
Valentin Bartenev 0d7a6885a3 Configure: verifying the Ruby library path.
An attempt to build a Ruby module for a custom Ruby installation that has the
same major version as the system Ruby may unexpectedly cause the use of the
system Ruby library.

This closes #449 issue on GitHub.
2020-08-08 23:52:31 +03:00
Valentin Bartenev b0ff245ca8 Improved mkstemp() error reporting.
The invocation parameters should be logged as well, notably the path of the file
that is failed to be created.

Also, log level changed to ALERT as it's quite critical error.
2020-08-05 16:11:20 +03:00
Valentin Bartenev 2b53c7bbbd Fixed nxt_conn_accept_alloc() behavior in low memory conditions.
Earlier, if nxt_mp_create() failed to allocate memory while accepting a new
connection, the resulting NULL was subsequently passed to nxt_mp_destroy(),
crashing the process.

More, if nxt_mp_create() was successful but nxt_sockaddr_cache_alloc() failed,
the connection object wasn't destroyed properly, leaving the connection counter
in an inconsistent state.  Repeated, this condition lowered the connection
capacity of the process and could eventually prevent it from accepting
connections altogether.
2020-08-05 14:55:34 +03:00
Valentin Bartenev 10f90f0d48 Configuration: added checking for presence of mandatory fields. 2020-07-24 20:25:20 +03:00
Valentin Bartenev 2a71a8a9f4 Added missing ending indicator in object members validation lists.
This fixes undefined behaviour due to array over-read if an unknown parameter
is specified in an uidmap, a gidmap, or a php target object.
2020-07-24 20:25:15 +03:00
Valentin Bartenev d86e0a7aec PHP: logging in request context when possible. 2020-07-21 20:27:37 +03:00
Valentin Bartenev f46ef1b121 PHP: fixed incorrect time in interpreter error log messages.
Previously, the log message callback used a generic log function, that relied on the process time cache.
Since there were no time update calls in the application processes, all log lines were printed with the
same time, usually correlated with the process start.

Now, a non-cached logging function from libunit is used.
2020-07-21 20:27:37 +03:00
Valentin Bartenev f69d470752 Fixed non-debug log time format in libunit.
This makes log format used in libunit consistent with the daemon, where milliseconds are printed only in the
debug log level.

Currently a compile time switch is used, since there's no support for runtime changing of a log level for now.
But in the future this should be a runtime condition, similar to nxt_log_time_handler().
2020-07-21 20:27:37 +03:00
Valentin Bartenev 5fa3108e63 Version bump. 2020-06-08 16:09:07 +03:00
Valentin Bartenev 829bf07c7c Adjusted tag 1.18.0 to include 9e14c63773be. 2020-05-28 19:32:52 +03:00
Valentin Bartenev 9d8e476c4e Added tag 1.18.0 for changeset a34bc498d976 2020-05-28 18:04:47 +03:00
Valentin Bartenev ebf86b34d1 Generated Dockerfiles for Unit 1.18.0. 2020-05-28 17:34:06 +03:00
Valentin Bartenev 943865fc77 Added version 1.18.0 CHANGES. 2020-05-28 17:34:06 +03:00