summaryrefslogtreecommitdiffhomepage
path: root/src (follow)
AgeCommit message (Collapse)AuthorFilesLines
2020-03-30Configuration: support for rational numbers.Valentin Bartenev8-170/+135
2020-03-30Fixing application process infinite loop.Max Romanov1-21/+28
Main process exiting before app process init may have caused hanging.
2020-03-30Handling change file message in libunit.Max Romanov1-0/+10
This is required for proper log file rotation action.
2020-03-30Attributing libunit logging function for arguments validation.Max Romanov4-10/+31
2020-03-21Implemented "location" option for "return" action.Valentin Bartenev5-2/+60
This allows to specify redirects: { "action": { "return": 301, "location": "https://www.example.com/" } }
2020-03-27Added nxt_is_complex_uri_encoded()/nxt_encode_complex_uri().Valentin Bartenev2-44/+158
2020-03-27Updated URI escaping table for better conformity with RFC 3986.Valentin Bartenev1-6/+4
Now '>', '<', '"', '^', '\', '}', '|', '{', and '`' are also escaped.
2020-03-27Implemented "return" action.Valentin Bartenev4-4/+95
The "return" action can be used to immediately generate a simple HTTP response with an arbitrary status: { "action": { "return": 404 } } This is especially useful for denying access to specific resources.
2020-03-27Initialization of the action object made more consistent.Valentin Bartenev1-3/+3
2020-03-25Configuration: fixed comments parsing.Valentin Bartenev1-1/+5
Unclosed multi-line comments and "/" at the end of JSON shouldn't be allowed.
2020-03-19Completing buffers immediatelyMax Romanov1-5/+2
This fixes crash introduced in 039b00e32e3d.
2020-03-19Completing request header buffers to avoid memory leak.Max Romanov3-22/+29
Before this fix, only persistent connection request buffers were completed. This issue was introduced in dc403927ab0b.
2020-03-17Fixing body fd access racing condition.Max Romanov2-16/+32
To avoid closing the body fd prematurely, the fd value is moved from the request struct to the app link. The body fd should not be closed immediately after the request is sent to the application due to possible request rescheduling.
2020-03-12Using disk file to store large request body.Max Romanov10-36/+441
This closes #386 on GitHub.
2020-03-12Moving request memory pool retain call after RPC data allocation.Max Romanov2-10/+15
If the call is done only after a successful RPC data allocation, its corresponding release call is not missed, which avoids a potential leak.
2020-03-12Checking Content-Length value right after header parse.Max Romanov2-6/+8
The check was moved from the request body read stage.
2020-03-12Python: implementing input readline and line iterator.Max Romanov1-2/+145
2020-03-12Introducing readline function in libunit.Max Romanov4-44/+53
Ruby and Java modules now use this function instead of own implementations.
2020-03-06Round robin upstream added.Igor Sysoev10-34/+653
2020-03-04Legacy upstream code removed.Igor Sysoev4-274/+0
2020-03-04Refactored nxt_http_action.Igor Sysoev3-21/+19
2020-03-11Fixed negative patterns combined with address rules.Axel Duch1-6/+40
2020-03-04PHP: fixed log format in alert.Tiago Natel de Moura1-1/+2
Found by Coverity: CID 354832 and CID 354833.
2020-03-04The kqueue EOF flag might be ignored on some conditions.Igor Sysoev1-2/+2
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-03Added a "fallback" option to be used with the "share" action.Valentin Bartenev4-23/+68
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-03Improved validation of the "action" object.Valentin Bartenev1-16/+41
Now it enforces the mutual exclusivity of "pass", "proxy", and "share" options.
2020-03-03PHP: optimization to avoid surplus chdir(2) calls.Tiago Natel de Moura1-99/+299
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-03Fixing request_app_link reference counting for delayed requests.Max Romanov1-9/+36
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-03Java: fixing Spring applications start.Max Romanov1-1/+1
This closes #403 issue on GitHub.
2020-03-03Node.js: fixing x86 warning about the signed/unsigned comparison.Max Romanov1-2/+1
2020-02-25PHP: fixed php >= 7.4 with zts enabled.Tiago Natel de Moura1-13/+17
2020-02-20Configuration: removing UTF-8 BOM from the input JSON.Valentin Bartenev1-0/+7
Some editors can add it to JSON files.
2020-02-20Configuration: stripping comments from the input JSON.Valentin Bartenev1-6/+66
This allows to have JavaScript-like comments in the uploading JSON.
2020-02-05Kept the value of c->socket.read_handler while data is available.Tiago Natel de Moura1-4/+0
This closes #370 in GitHub.
2020-02-04Removing duplicate macro definitions.Max Romanov1-4/+0
This issue was introduced in 2c7f79bf0a1f.
2020-02-03Initializing local buffer ctx_impl field for correct release.Max Romanov1-0/+1
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-03Fixed req_app_link reference counting on cancellation.Max Romanov1-16/+7
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-03Storing pointer to next buffer in chain before free the buffer.Max Romanov1-2/+3
This is required to avoid dereference of freed memory. Found by Coverity (CID 353372).
2020-02-03Added missing stream argument to error message.Max Romanov1-1/+2
Found by Coverity (CID 353386).
2020-02-03Freeing memory allocated for engine structure in case of error.Max Romanov1-1/+1
Found by Coverity (CID 353389).
2020-01-28PHP: added check for the ".php" extension.Valentin Bartenev1-4/+11
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-28Fixed missing IPv6 checking in route-addr and an unused variable.Axel Duch1-2/+6
This closes #363 issue on Github. Thanks to to 洪志道 (Hong Zhi Dao).
2020-01-28Node.js: suppress compilation warning.Max Romanov1-1/+1
2020-01-28Ruby: changing callback functions prototype for v2.7.Max Romanov2-11/+13
This closes #371 issue on GitHub.
2019-12-16Using the 64-bit Linux capability mode when available.Tiago Natel de Moura1-1/+11
For backward compatibility, the Linux capabilities macros exposes v1 semantics (32-bit) by default. We probe the version at runtime (because of pre-compiled binaries) but the kernel syscall API is conservative and it doesn't return a 64-bit capability version if the input version is v1. This patch suppress the kernel > 5.0 dmesg log below: capability: warning: 'unitd' uses 32-bit capabilities (legacy support in use)
2019-12-24Router: introducing routing on listener address.Axel Duch2-4/+36
2019-12-24Router: introducing routing on client address.Axel Duch5-4/+733
2019-12-24Node.js: implementing output message drain using SHM_ACK feature.Max Romanov3-26/+188
ServerResponse.write() method tries to write data buffer using libunit and stores buffers to write in a Server-wide output queue, which is processed in response to SHM_ACK message from router. As a side effect 'drain' event implemented and socket.writable flag reflect current state.
2019-12-24Introducing port messages to notify about out of shared memory.Max Romanov6-68/+567
- OOSM (out of shared memory). Sent by application process to router when application reaches the limit of allocated shared memory and needs more. - SHM_ACK. Sent by router to application when the application's shared memory is released and the OOSM flag is enabled for the segment. This implements blocking mode (the library waits for SHM_ACK in case of out of shared memory condition and retries allocating the required memory amount) and non-blocking mode (the library notifies the application that it's out of shared memory and returns control to the application module that sets up the output queue and puts SHM_ACK in the main message loop).
2019-12-24Adding "limits/shm" configuration validation and parsing.Max Romanov11-11/+67