Commit graph

1336 commits

Author SHA1 Message Date
Igor Sysoev
7935ea4543 Round robin upstream added. 2020-03-06 18:28:54 +03:00
Igor Sysoev
794248090a Legacy upstream code removed. 2020-03-04 14:04:08 +03:00
Igor Sysoev
643d4383fa Refactored nxt_http_action. 2020-03-04 14:03:32 +03:00
Andrei Zeliankou
b214b7c690 Tests: more routing tests with negative rules. 2020-01-31 18:12:16 +00:00
Axel Duch
f302ed0670 Fixed negative patterns combined with address rules. 2020-03-11 14:18:39 +00:00
Andrei Zeliankou
f092b093f5 Tests: use blocking to print unit.log files. 2020-03-10 18:13:47 +00:00
Andrei Zeliankou
f36f0f2461 Tests: redirect tests output to the stdout. 2020-03-10 18:10:42 +00:00
Valentin Bartenev
810b8dbb67 Tests: unitd stderr output redirected to unit.log.
A part of the debug log was printed to stderr before the log file was opened.
Now, this output is redirected to the same log file.
2020-03-06 20:08:38 +03:00
Valentin Bartenev
3617d4ed03 Tests: simplified unitd process running.
There are no reasons to wrap the Unit daemon in a separate Python process.
2020-03-06 20:08:29 +03:00
Tiago Natel de Moura
36578c7b43 PHP: fixed log format in alert.
Found by Coverity: CID 354832 and CID 354833.
2020-03-04 13:42:08 +00:00
Igor Sysoev
2d0dca5243 The kqueue EOF flag might be ignored on some conditions.
If kqueue reported both the EVFILT_READ and the EVFILT_WRITE events
for the socket but only the former had the EV_EOF flag set, the flag
was silently ignored.
2020-03-04 14:03:30 +03:00
Valentin Bartenev
afa2f86ecf PHP: added ZTS indication to ./configure output. 2020-03-04 15:24:27 +03:00
Valentin Bartenev
75cb2a947d PHP: rearranged feature checks in ./configure.
Now it prints version even if PHP was built without embed SAPI.
2020-03-04 15:24:27 +03:00
Tiago Natel de Moura
80763b3e64 Tests: chdir() and open() for PHP module.
These tests ensure optimizations in the chdir calls don't break
SAPI semantics.
2020-03-03 18:53:26 +00:00
Andrei Zeliankou
293b0da520 Tests: added tests for "fallback" option for the "share" action. 2020-03-03 18:17:31 +00:00
Andrei Zeliankou
3b7b2fae54 Tests: check unique options in "action" object. 2020-03-03 17:54:02 +00:00
Valentin Bartenev
a98de7f705 Added a "fallback" option to be used with the "share" action.
It allows proceeding to another action if a file isn't available.

An example:

    {
        "share": "/data/www/",

        "fallback": {
            "pass": "applications/php"
        }
    }

In the example above, an attempt is made first to serve a request with
a file from the "/data/www/" directory.  If there's no such file, the
request is passed to the "php" application.

Fallback actions may be nested:

    {
        "share": "/data/www/",

        "fallback": {
            "share": "/data/cache/",

            "fallback": {
                "proxy": "http://127.0.0.1:9000"
            }
        }
    }
2020-03-03 20:37:47 +03:00
Valentin Bartenev
a60f856ce2 Improved validation of the "action" object.
Now it enforces the mutual exclusivity of "pass", "proxy", and "share" options.
2020-03-03 20:37:47 +03:00
Tiago Natel de Moura
f99d20ad39 PHP: optimization to avoid surplus chdir(2) calls.
For each request, the worker calls the php_execute_script function
from libphp that changes to the script directory before doing its
work and then restores the process directory before returning.  The
chdir(2) calls it performs are unnecessary in Unit design.  In simple
benchmarks, profiling shows that the chdir syscall code path (syscall,
FS walk, etc.) is where the CPU spends most of its time.

PHP SAPI semantics requires the script to be run from the script
directory.  In Unit's PHP implementation, we have two use cases:

- script
- arbitrary path

The "script" configuration doesn't have much need for a working
directory change: it can be changed once at module initialization.
The module needs to chdir again only if the user's PHP script also
calls chdir to switch to another directory during execution.

If "script" is not used in Unit configuration, we must ensure the
script is run from its directory (thus calling chdir before exec),
but there's no need to restore the working directory later.

Our implementation disables mandatory chdir calls with the SAPI
option SAPI_OPTION_NO_CHDIR, instead calling chdir only when needed.

To detect the user's calls to chdir, a simple "unit" extension is
added that hooks the built-in chdir() PHP call.
2020-03-03 14:38:08 +00:00
Max Romanov
9e295fa314 Fixing request_app_link reference counting for delayed requests.
Router built with debug may stop with assertion during stalled requests
re-schedule.  This was caused by missing reference counting increment
before nxt_router_port_select() call.
2020-03-03 18:28:26 +03:00
Max Romanov
c74f3a6c56 Java: fixing Spring applications start.
This closes #403 issue on GitHub.
2020-03-03 18:28:20 +03:00
Max Romanov
004ab48a9e Node.js: fixing x86 warning about the signed/unsigned comparison. 2020-03-03 18:28:16 +03:00
Andrei Zeliankou
f68947bc60 Tests: truncated huge messages while logging. 2020-03-02 13:10:38 +00:00
Andrei Zeliankou
5d67879a50 Tests: added "-r" option to print unit.log on failures. 2020-02-27 18:41:24 +00:00
Andrei Zeliankou
fbc72d7fec Tests: added test with invalid IPv6 address in routing block. 2020-02-27 01:37:54 +00:00
Tiago Natel de Moura
98c0ce6cc4 PHP: fixed php >= 7.4 with zts enabled. 2020-02-25 15:55:31 +00:00
Andrei Zeliankou
f519e31e2d Tests: more static tests. 2020-02-21 15:08:38 +00:00
Andrei Zeliankou
5406d1e320 Tests: added PHP test with invalid index extension only. 2020-02-20 21:06:56 +00:00
Andrei Zeliankou
1f2445b01b Tests: added proxy test with large body. 2020-02-20 21:06:31 +00:00
Andrei Zeliankou
fcca366392 Tests: more tests with "max_body_size". 2020-02-20 20:33:49 +00:00
Valentin Bartenev
d198a105eb Configuration: removing UTF-8 BOM from the input JSON.
Some editors can add it to JSON files.
2020-02-20 17:58:24 +03:00
Valentin Bartenev
044b3afcda Configuration: stripping comments from the input JSON.
This allows to have JavaScript-like comments in the uploading JSON.
2020-02-20 17:58:24 +03:00
Valentin Bartenev
7a0383189c Version bump. 2020-02-19 19:13:51 +03:00
Valentin Bartenev
6e19090736 Added tag 1.15.0 for changeset 801ac82f80fb 2020-02-06 18:20:37 +03:00
Valentin Bartenev
e6bb4c5493 Generated Dockerfiles for Unit 1.15.0. 2020-02-06 17:33:44 +03:00
Valentin Bartenev
672602d1ee Added version 1.15.0 CHANGES. 2020-02-06 17:33:44 +03:00
Tiago Natel de Moura
12e15ba43b Tests: added test for uploading files with SSL.
* * *
[mq]: multipart
2020-02-05 13:29:41 +00:00
Tiago Natel de Moura
d3e218a8c3 Tests: add helper for form-data and multipart. 2020-02-05 13:13:04 +00:00
Tiago Natel de Moura
29d8b34244 Kept the value of c->socket.read_handler while data is available.
This closes #370 in GitHub.
2020-02-05 13:12:31 +00:00
Max Romanov
81b39d0b35 Tests: fixing Python 3.8.1 errors on Mac.
- "Can't pickle local object ..."
- "if __name__ == '__main__':" pattern required for multiprocessing
2020-02-04 11:39:34 +03:00
Max Romanov
7c38650cd1 Removing duplicate macro definitions.
This issue was introduced in 2c7f79bf0a1f.
2020-02-04 11:39:16 +03:00
Max Romanov
8eba2e5c3d Initializing local buffer ctx_impl field for correct release.
Uninitialized ctx_impl field may cause crash in application process.

To reproduce the issue, need to trigger shared memory buffer send error on
application side.  In our case, send error caused by router process crash.

This issue was introduced in 2c7f79bf0a1f.
2020-02-03 11:21:21 +03:00
Max Romanov
7ea9ebc55a Fixed req_app_link reference counting on cancellation.
Re-scheduled req_app_link structures should have use_count exactly equal
to the number of references from the application and port list.  However,
there's one extra usage decrement that occurs after the req_app_link is
created because the use_count is initialised as 1.

This patch removes all excess instances of the usage decrement that caused
preliminary req_app_link release and router process crash.

To reproduce the issue need to cause request rescheduling between 2 app
processes.

This issue was introduced in 61e9f23a566d.
2020-02-03 11:20:59 +03:00
Max Romanov
8c0f2cebf5 Storing pointer to next buffer in chain before free the buffer.
This is required to avoid dereference of freed memory.

Found by Coverity (CID 353372).
2020-02-03 11:14:14 +03:00
Max Romanov
51120e06e3 Added missing stream argument to error message.
Found by Coverity (CID 353386).
2020-02-03 11:14:06 +03:00
Max Romanov
224549a578 Freeing memory allocated for engine structure in case of error.
Found by Coverity (CID 353389).
2020-02-03 11:13:55 +03:00
Tiago Natel de Moura
117a4f11b9 Tests: check for php extension. 2020-01-23 11:57:15 +00:00
Valentin Bartenev
f860c20a96 PHP: added check for the ".php" extension.
A check for the ".php" extension is added to prevent execution of files
with arbitrary extensions in cases where "index" and "script" options
aren't used.
2020-01-28 19:18:26 +03:00
Max Romanov
4024b18bcc Go: adding main configure CFLAGS and LDFLAGS to module build flags.
This makes ASAN buildbot workers to work out-of-the-box.
2020-01-28 19:20:46 +03:00
Axel Duch
4eb2d3086b Fixed missing IPv6 checking in route-addr and an unused variable.
This closes #363 issue on Github.
Thanks to to 洪志道 (Hong Zhi Dao).
2020-01-28 15:05:12 +00:00