Commit Graph
100 Commits
Author SHA1 Message Date
Valentin Bartenev e9429324c2 Python: improved error handling if response object isn't iterable.
According to the documentation, PyObject_GetIter():

 | Raises TypeError and returns NULL if the object cannot be iterated.

Previously, this exception wasn't printed or cleared and remained unhandled.
2019-11-14 17:48:48 +03:00
Valentin Bartenev e189d0a96c Python: fixed handling of errors on response object iteration.
According to the documentation, PyIter_Next():

 | If there are no remaining values, returns NULL with no exception set.
 | If an error occurs while retrieving the item, returns NULL and passes
 | along the exception.

Previously, this exception wasn't properly handled and the response was
finalized as successful.

This issue was introduced in b0148ec28c4d.

A check for PyErr_Occurred() located in the code below might print this
traceback or occasionally catch an exception from one of the two response
close() calls.

Albeit that exceptions from the close() calls also need to be catched,
it's clear that this particular check wasn't supposed to do so.  This is
another issue and it will be fixed later.
2019-11-14 17:48:48 +03:00
Valentin Bartenev 69ff7ce731 Python: releasing GIL while waiting for a request.
It unblocks other threads that can be forked by the application
to work in background.

This closes #336 issue on GitHub.
2019-11-13 16:45:37 +03:00
Valentin Bartenev cc82547782 Respecting AR environment variable to configure ar binary. 2019-11-07 19:53:25 +03:00
Valentin Bartenev 75453479f3 Configuration: added check for mandatory options of "action". 2019-10-09 15:26:59 +03:00
Valentin Bartenev 1b4c96f265 Version bump. 2019-10-07 18:38:41 +03:00
Valentin Bartenev 59db9a3887 Added tag 1.12.0 for changeset b391df5f0102 2019-10-03 17:34:58 +03:00
Valentin Bartenev 946cbd1f10 Generated Dockerfiles for Unit 1.12.0. 2019-10-03 17:08:32 +03:00
Valentin Bartenev b1cb78ef8e Added version 1.12.0 CHANGES. 2019-10-03 16:30:31 +03:00
Valentin Bartenev 73f096f796 Added response status code to error page body.
Also the error page markup is now valid according to HTML5 specification.
All optional tags were omitted.
2019-10-02 20:04:52 +03:00
Valentin Bartenev f8ff71b917 HTTP: corrected allocation size for tail chunk. 2019-09-30 19:11:17 +03:00
Valentin Bartenev f7d3db314d HTTP parser: removed unused "exten" field.
This field was intended for MIME type lookup by file extension when serving
static files, but this use case is too narrow; only a fraction of requests
targets static content, and the URI presumably isn't rewritten.  Moreover,
current implementation uses the entire filename for MIME type lookup if the
file has no extension.

Instead of extracting filenames and extensions when parsing requests, it's
easier to obtain them right before serving static content; this behavior is
already implemented.  Thus, we can drop excessive logic from parser.
2019-09-30 19:11:17 +03:00
Valentin Bartenev 2dbda125db HTTP parser: normalization of paths ending with "." or "..".
Earlier, the paths were normalized only if there was a "/" at the end, which
is wrong according to section 5.2.4 of RFC 3986 and hypothetically may allow
to the directory above the document root.
2019-09-30 19:11:17 +03:00
Valentin Bartenev f2c0f2899a Refactored nxt_process_create() for more explicit pipe closing. 2019-09-26 16:03:02 +03:00
Valentin Bartenev 9c06bfdf2c Fixed descriptors leak on process creation.
The leak has been introduced in 325b315e48c4.
This closes #322 issue in GitHub.
2019-09-26 16:03:01 +03:00
Valentin Bartenev 514f34144a Static: returning 404 for Unix domain sockets.
It's now similar to how attempts to access other non-regular files are handled.
2019-09-24 15:33:42 +03:00
Valentin Bartenev 5c50329f8e Fixed segfault if an inappropriate file system object is requested.
Found by Coverity (CID 349483).
2019-09-20 14:31:19 +03:00
Valentin Bartenev 8853dece44 Version bump. 2019-09-20 14:29:11 +03:00
Valentin Bartenev db777d1e7f Added tag 1.11.0 for changeset 3b1601ac0f2f 2019-09-19 17:38:16 +03:00
Valentin Bartenev 7d53cc7029 Generated Dockerfiles for Unit 1.11.0. 2019-09-19 17:36:09 +03:00
Valentin Bartenev 2281d9f02c Added version 1.11.0 CHANGES. 2019-09-19 17:28:55 +03:00
Valentin Bartenev 08a8d1510d Basic support for serving static files. 2019-09-19 02:47:09 +03:00
Valentin Bartenev ca01845d89 Configuration: added ability to modify object members with slashes.
Example:

  PUT/POST/DELETE /config/listeners/unix:%2Fpath%2Fto%2Fsocket

This follows a49ee872e83d.
2019-09-18 16:03:28 +03:00
Valentin Bartenev 6352c21a58 HTTP parser: fixed parsing of target after literal space character.
In theory, all space characters in request target must be encoded; however,
some clients may violate the specification.  For the sake of interoperability,
Unit supports unencoded space characters.

Previously, if there was a space character before the extension or arguments
parts, those parts weren't recognized.  Also, quoted symbols and complex
target weren't detected after a space character.
2019-09-17 18:40:21 +03:00
Valentin Bartenev 3b77e402a9 HTTP parser: removed unused "plus_in_target" flag. 2019-09-16 20:17:42 +03:00
Valentin Bartenev 56f4085b9d HTTP parser: removed unused "offset" field.
Thanks to 洪志道 (Hong Zhi Dao).
2019-09-16 20:17:42 +03:00
Valentin Bartenev 2fb7a1bfb9 HTTP parser: removed unused "exten_start" and "args_start" fields. 2019-09-16 20:17:42 +03:00
Valentin Bartenev 64be8717bd Configuration: added ability to access object members with slashes.
Now URI encoding can be used to escape "/" in the request path:

  GET /config/listeners/unix:%2Fpath%2Fto%2Fsocket/
2019-09-16 20:17:42 +03:00
Valentin Bartenev 1298824130 Version bump. 2019-08-26 18:06:03 +03:00
Valentin Bartenev bc57d1d076 Added tag 1.10.0 for changeset cdbba3c3e376 2019-08-22 18:56:22 +03:00
Valentin Bartenev 19f59b221d Generated Dockerfiles for Unit 1.10.0. 2019-08-22 18:43:25 +03:00
Valentin Bartenev 700987c355 Fixed rebuilding of Dockerfiles. 2019-08-22 18:43:21 +03:00
Valentin Bartenev 0a106e3cbc Added version 1.10.0 CHANGES. 2019-08-22 18:43:02 +03:00
Valentin Bartenev 274260bd28 Router: allowed empty configurations.
Now it's possible to delete "listeners" and "applications" objects.

This closes #187 issue on GitHub.
2019-08-06 17:13:13 +03:00
Valentin Bartenev 7fd9444728 Node.js: returning "this" from writeHead() to allow chaining.
In Node.js version 11.10.0 and later, the writeHead() function returns "this".
2019-08-06 16:24:11 +03:00
Valentin Bartenev 242dc363ce Perl: propagated compile options from perl build.
Some Perl compile options affects ABI and not using them while compiling
our module resulted in non-working build.

Notably on 32-bit Debian 10, Perl is built with -D_FILE_OFFSET_BITS=64
and our module after being compiled without this option caused segmentation
faults in unexpected places.
2019-07-17 21:17:30 +03:00
Valentin Bartenev dbce694d5a Perl: removed "--include=" configure option.
It's surplus option because the perl executable returns the proper path.

Also the Perl module configure script was cleaned up a bit.
Note that NXT_PERL_LDOPTS already contains the library path.
2019-07-17 21:17:30 +03:00
Valentin Bartenev ef89815f03 PHP: fixed script filename setting, broken after 2a71417d297f. 2019-07-16 17:58:48 +03:00
Valentin Bartenev 924165c90b PHP: improved response status code handling.
There's no reason to parse "http_status_line"; the PHP interpreter already
does this.  If the line contains a valid status code, it's assigned to
"http_response_code".

This also fixes invalid status line handling, where the nxt_int_parse()
function returned -1; it was cast to unsigned, yielding response code 65535.
2019-07-05 18:42:30 +03:00
Valentin Bartenev b2a0620483 Version bump. 2019-06-10 15:53:26 +03:00
Valentin Bartenev 7da320a93a Added tag 1.9.0 for changeset dda6319de785 2019-05-30 17:39:43 +03:00
Valentin Bartenev 081a6baeb7 Generated Dockerfiles for Unit 1.9.0. 2019-05-30 17:16:24 +03:00
Valentin Bartenev b2d7d6fb02 Added version 1.9 CHANGES. 2019-05-30 17:16:23 +03:00
Valentin Bartenev 6a6bc63c48 Configuration: support for POST operations on arrays.
It allows to add an array element without specifying the index.
2019-04-24 20:31:00 +03:00
Valentin Bartenev 4d35a7bbac Configuration: support for manipulations of array elements.
Now PUT and DELETE operations also work on elements.
This closes #242 issue on GitHub.
2019-04-24 20:31:00 +03:00
Valentin Bartenev 30768b7b3c Refactored nxt_conf_op_compile().
Now index is always initialized for create operations.

The changes in nxt_conf_op_compile() simplify adding upcoming support of
operations with arrays.

No functional changes.
2019-04-24 20:31:00 +03:00
Valentin Bartenev 1467d34d73 Removed unused field from nxt_conf_op_s. 2019-04-24 20:31:00 +03:00
Valentin Bartenev 094cc2fc99 Packages: using "pass" option in config examples.
The "application" option has been deprecated since 1.8.0.
2019-04-24 20:31:00 +03:00
Valentin Bartenev c1a3b06d03 Tests: using "pass" option instead of deprecated "application". 2019-04-22 18:20:53 +03:00
Valentin Bartenev 5e1cf14565 Controller: rejecting double wildcards. 2019-04-12 17:44:55 +03:00
Valentin Bartenev f0cc14d394 Simplified cycles in nxt_http_route_rule(). 2019-04-12 17:44:54 +03:00
Valentin Bartenev 7b839bf5da Backed out changeset f74d4dd9c3db.
This closes #240 issue on GitHub.
2019-04-03 18:40:47 +03:00
Valentin Bartenev f3a0d95d09 Version bump. 2019-03-05 14:57:46 +03:00
Valentin Bartenev df02b03824 Added tag 1.8.0 for changeset 0a18a14d169f 2019-03-01 18:26:10 +03:00
Valentin Bartenev 204dfec879 Generated Dockerfiles for Unit 1.8.0. 2019-03-01 18:23:39 +03:00
Valentin Bartenev 050cfb6d5b Added version 1.8.0 CHANGES. 2019-03-01 18:23:38 +03:00
Valentin Bartenev d92feef571 README.JSR-340 legal notice to save our ughm.. bottoms of bodies. 2019-03-01 17:12:40 +03:00
Valentin Bartenev a5dd0f8aa9 Made QUERY_STRING mandatory.
According to CGI/1.1 RFC 3875:

   The server MUST set this variable; if the Script-URI does not include a
   query component, the QUERY_STRING MUST be defined as an empty string ("").

Python's PEP 333(3) allows omitting it in WSGI interface; PHP docs force no
requirements; PSGI and Rack specifications require it even if empty.

When nginx proxies requests over FastCGI, it always provides QUERY_STRING.
and some PHP apps have been observed to fail if it is missing (see issue
#201 on GitHub).

A drawback of this change (besides a small overhead) is that there will be
no easy way to tell a missing query string from an empty one (i.e. requests
with or without the "?" character); yet, it's negligible compared to the
possible benefits of wider application compatibility.

This closes #226 issue on GitHub.
2019-02-28 20:20:41 +03:00
Valentin Bartenev 5c9fe8c306 Added trailing zero to version string.
While it looks nicer without zero 3-rd version number, this should
improve interoperability.  Version string can be parsed or used for
sorting.  And it is easier to handle and less confusing when there
is constant number of version parts.

Moreover, NPM also expects version format with 3 parts.
So ".0" has already been used in Node.js module version.
2019-02-27 17:25:28 +03:00
Valentin Bartenev e929d08201 Fixed processing of SERVER_NAME after 77aad2c142a0.
Previously, the nxt_router_prepare_msg() function expected server host among
other headers unmodified.  It's not true anymore since normalization of the
Host header has been introduced in 77aad2c142a0.

The nxt_unit_split_host() function was removed.  It didn't work correctly with
IPv6 literals.  Anyway, after 77aad2c142a0 the port splitting is done in router
while Host header processing.
2019-02-27 17:25:07 +03:00
Valentin Bartenev a881c31abd Controller: added "routes" configuration. 2019-02-27 16:50:37 +03:00
Valentin Bartenev c24c0deb19 Controller: added "pass" configuration option. 2019-02-27 16:44:52 +03:00
Valentin Bartenev ce6ce15c20 Fixed violation of the strict aliasing rules in 5d0edd35c4ce.
In order to reduce number of operations over rb-tree and process them in
batches simultaneously, all the timers changes are temporary stored in array.
While processing of these changes, the same memory is also used for storing
pointers to postpone timers adding.

As the same block of memory has been referenced by two different types of
pointers (nxt_timer_change_t * and nxt_timer_t **), some compilers may reorder
operations with these pointers and produce broken code.  See ticket #221 on
GitHub for a particular case.

Now the same "nxt_timer_change_t" structure is used in both cases.

Also, reverted the -fno-strict-aliasing flag, which has been introduced in
ef76227ec159 as a workaround for this issue.
2019-02-26 17:42:20 +03:00
Valentin Bartenev d8c0a0dbe2 Disabled useless code in nxt_router_listen_socket_error().
It doesn't do anything useful, among creating a JSON message and logging it
to debug log.  Besides that it causes segmentation fault if the RPC handler
is triggered with an empty buffer due to exiting of the main process.
2019-02-25 15:10:44 +03:00
Valentin Bartenev c5563d142d Removed surplus check for NUL in nxt_http_validate_host().
Such header fields are already rejected by HTTP parser.
2019-02-23 14:48:33 +03:00
Valentin Bartenev 2d4697dbbe Validation and normalization of request host. 2019-02-19 20:25:25 +03:00
Valentin Bartenev 2a6b54c230 Rejecting requests with duplicate "Content-Length". 2019-02-18 16:51:30 +03:00
Valentin Bartenev 0f008918b3 Merged with the 1.7 branch. 2019-02-11 15:42:16 +03:00
Valentin Bartenev fc2af29bd3 Added tag 1.7.1 for changeset 0f04ef991fbc 2019-02-07 17:48:13 +03:00
Valentin Bartenev 6680fd5b8c Generated Dockerfiles for Unit 1.7.1. 2019-02-07 17:46:46 +03:00
Valentin Bartenev 9a9277b227 Added version 1.7.1 CHANGES. 2019-02-07 17:46:46 +03:00
Valentin Bartenev a2cbe890a1 Rejecting requests with invalid "Content-Length". 2019-02-07 17:40:27 +03:00
Valentin Bartenev 83dd67d216 Rejecting requests with invalid "Content-Length". 2019-02-07 17:40:27 +03:00
Valentin Bartenev 73eceb7e56 Year 2019. 2019-01-09 18:03:48 +03:00
Valentin Bartenev 8193601226 Year 2019. 2019-01-09 18:03:48 +03:00
Valentin Bartenev e038f1e9cc Version bump. 2019-02-07 17:42:31 +03:00
Valentin Bartenev fac0ef29d5 Version bump. 2018-12-24 20:31:45 +03:00
Valentin Bartenev 4195a29fab Added tag 1.7 for changeset 784b45adb0fe 2018-12-20 19:23:59 +03:00
Valentin Bartenev c51e1aa47d Generated Dockerfiles for Unit 1.7. 2018-12-20 19:17:08 +03:00
Valentin Bartenev 45655f2652 Added version 1.7 CHANGES. 2018-12-20 19:17:08 +03:00
Valentin Bartenev 61a87bc285 Fixed style in CHANGES. 2018-12-20 19:17:08 +03:00
Valentin Bartenev 27394118b3 Python: fixed error reporting on initialization of applications.
PyErr_Print() writes traceback to "sys.stderr", which is a file object that
can buffer the output.  If the process exits immediately, the buffer can be
destroyed before flushing to the log.  As a result, the user doesn't see
the traceback.

Now Py_Finalize() is also called in case of any errors during initialization.
It finalizes the interpreter and flushes all data.
2018-12-20 15:47:10 +03:00
Valentin Bartenev 1ce7e860b2 Python: cleanup of nxt_python_init().
- Removed surplus NULL assignments;
 - Added missing nxt_slow_path();
 - Style cleanup.
2018-12-20 15:47:10 +03:00
Valentin Bartenev cebec46353 Python: replaced PyErr_PrintEx(1) with PyErr_Print().
These function calls are equivalent.
No functional changes.
2018-12-19 20:06:53 +03:00
Valentin Bartenev aeb026c8ab Node.js: removed unused dependency. 2018-12-12 19:57:15 +03:00
Valentin Bartenev f51f95fa54 Node.js: fixed global install in some cases.
By default "npm install" switches to non-privileged user to run package scripts
if it is invoked by root.  As a result it may prevent node-gyp from writing to
package directory and break installation of the module.

To disable this switching the --unsafe-perm flag is added.
2018-12-12 19:54:52 +03:00
Valentin Bartenev d500e29f88 Ruby: rpath made optional.
In most cases it is not needed because Ruby libraries are in the default path.
At the same time, rpath pointing to the default path is prohibited by rpmbuild
on Fedora.

This is related to issue #87 on GitHub.
2018-12-04 17:18:00 +03:00
Valentin Bartenev db63191719 PHP: fixed "disable_functions" and "disable_classes" options.
It turned out they need additional processing to work.
This closes #183 issue on GitHub.
2018-11-27 22:06:39 +03:00
Valentin Bartenev 262578dc71 PHP: workaround for bug #71041.
Since PHP 7, a zend_signal_startup() call is required if the interpreter
was built with ZEND_SIGNALS defined; such a call was added in 3fd76e4ce70a.

However, the zend_signal_startup() export is missing from the PHP library;
as the result, dlopen() fails with the 'Undefined symbol "zend_signal_startup"'
error while loading the PHP module.

Meanwhile, if PHP is built without ZTS, the zend_signal_startup() call can
be omitted; otherwise, the missing call causes segmentation fault.

The PHP fix already was committed to upstream, but we still have to deal
with numerous unpatched versions remaining at large.

See the related PHP bug: https://bugs.php.net/bug.php?id=71041
2018-11-22 20:23:43 +03:00
Valentin Bartenev adf22b6a0d PHP: fixed compatibility with ZTS.
This closes #184 issue on GitHub.
2018-11-21 18:22:19 +03:00
Valentin Bartenev 39cd4a9dee Prettier ./configure summary. 2018-11-15 21:50:00 +03:00
Valentin Bartenev c1fd6cb589 Added TLS information to ./configure summary. 2018-11-15 20:08:46 +03:00
Valentin Bartenev e4d9cffedf Version bump. 2018-11-15 20:08:43 +03:00
Valentin Bartenev a4b02e1738 Added tag 1.6 for changeset d411e7fdee9e 2018-11-15 16:06:42 +03:00
Valentin Bartenev 1ebd23f11a Generated Dockerfiles for Unit 1.6. 2018-11-15 16:05:11 +03:00
Valentin Bartenev b4e2ec43d1 Added version 1.6 CHANGES. 2018-11-15 15:56:09 +03:00
Valentin Bartenev 2b4d83cbd8 Node.js: npm package readme cleanup. 2018-11-15 15:53:35 +03:00
Valentin Bartenev b033fb329f Fixed lvlhsh test on 64-bit big-endian systems.
The nxt_murmur_hash2() generated 4-byte hash that was stored in uintptr_t,
which was 8 bytes long on 64-bit systems.  At each iteration, it took the
previous key and hashed it again.

The problem was that it took only the first 4 bytes of the key, and these
4 bytes were always zero on 64-bit big-endian system.  That resulted in
equal keys at each iteration.

The bug was discovered on IBM/S390x.
2018-11-15 13:00:58 +03:00
Valentin Bartenev 08e0082e07 Fixed discovering of modules on 64-bit big-endian systems.
The nxt_conf_map_object() function used nxt_int_t for NXT_CONF_MAP_INT, which
was 8 bytes long on 64-bit systems.

But the nxt_port_main_start_worker_handler() used it to map into the int field
of the nxt_common_app_conf_t structure, which was 4 bytes.  As the result, on
a 64-bit big-endian system all the meaningful module type numbers were assigned
into the gap above the "type" field.

The bug was discovered on IBM/S390x.
2018-11-15 11:59:03 +03:00
Valentin Bartenev ed8bfc669f Node.js: reworked installation procedure.
Now by default "make install" installs the module globally.
The "--local" configure option added for local installation.
2018-11-14 20:12:47 +03:00