aboutsummaryrefslogtreecommitdiff
path: root/nginx/ngx_http_js_module.c
Commit message (Collapse)AuthorAge
* Fixed NULL pointer dereference when processing If-* headers.Dmitry Volyntsev7 days
| | | | | | | | | | | | Previously, when processing requests with If-Match and If-Unmodified-Since headers worker process crashed. For example with the following code: try { r.return(200) } catch (e) { r.internalRedirect() } The fix is to disable not_modified filter as it was done in nginx perl module nginx/nginx@d9887ee2.
* QuickJS: added memory limit check for reuse queue.Dmitry Volyntsev2025-05-27
|
* Modules: added state file for the shared dictionary.Dmitry Volyntsev2025-05-22
| | | | | | | | | A new optional state parameter is added for js_shared_dict_zone directive. state parameter specifies a file that keeps the current state of the shared dict in the JSON format and makes it persistent across nginx restarts. This closes #709 feature request on Github.
* Modules: separating different init worker components.Dmitry Volyntsev2025-05-22
|
* Fetch: QuickJS support.Zhidao HONG2025-05-09
|
* Refactored working with built-in strings, symbols and small integers.Vadim Zhestikov2025-04-29
| | | | | | | | | | | | | | | | - Implemented atom IDs for strings, symbols and small numbers, enabling equality checks via ID comparison - Optimized string operations for faster property lookups and comparisons - Removed short string inlining from njs_value_t structure Performance improvements (arewefastyet/benchmarks/v8-v7 benchmark): - Richards: +57% (631 → 989) - Crypto: +7% (1445 → 1551) - RayTrace: +37% (562 → 772) - NavierStokes: +20% (2062 → 2465) - Overall score: +29% (1014 → 1307) In collaboration with Dmitry Volyntsev.
* Replaced vm with mp in NJS_CHB_MP_INIT().Zhidao HONG2025-04-22
|
* QuickJS: added xml to nginx modules.Dmitry Volyntsev2025-04-03
| | | | Missed in cec9a1650.
* QuickJS: fixed compatibility issues with QuickJS-NG 0.9.0.Dmitry Volyntsev2025-03-27
| | | | This fixes #872 on Github.
* QuickJS: calling njs_chb_destroy() in qjs_string_create_chb() internally.hongzhidao2025-03-19
| | | | No functional changes.
* QuickJS: making ngx_qjs_*() functions consistent with ngx_js_*().hongzhidao2025-03-18
|
* QuickJS: using helper to declare Symbol.toStringTag properties.Dmitry Volyntsev2025-02-25
|
* QuickJS: fixed memory leak in js_periodic handler.Dmitry Volyntsev2025-02-20
|
* Modules: fixed name corruption in variable and header processing.Dmitry Volyntsev2025-02-10
| | | | | | | | | The HTTP and Stream JS modules were performing in-place lowercasing of variable and header names, which could inadvertently overwrite the original data. In the NJS engine, the problem did not manifest itself for strings up to 14 bytes long because they are inlined into the value.
* HTTP: reading r.requestText or r.requestBuffer from a temp file.Dmitry Volyntsev2025-01-31
| | | | | | Previously, an exception was thrown when accessing r.requestText or r.requestBuffer if a client request body size exceeded client_body_buffer_size.
* QuickJS: added WebCrypto module.Dmitry Volyntsev2025-01-24
|
* QuickJS: correctly handling value len for empty query params.Dmitry Volyntsev2025-01-24
|
* HTTP: fixed limit rated output.Dmitry Volyntsev2024-11-27
| | | | | | Previously, when r.return(code, body) was called from a subrequest handler with a body size larger than the sendfile_max_chunk value connection hanging might occur.
* Modules: added js_shared_dict_zone support in QuickJS engine.Dmitry Volyntsev2024-10-30
|
* HTTP: added strict check for js_body_filter syntax.Dmitry Volyntsev2024-10-17
|
* Fixed dead store assignment in r.subrequest().Dmitry Volyntsev2024-10-14
| | | | Found by Clang static analyzer.
* HTTP: fixed r.return() with empty string as a body argument.Dmitry Volyntsev2024-09-25
|
* HTTP: fixed r.subrequest() check for nested subrequests.Dmitry Volyntsev2024-09-17
| | | | | | The issue was introduced in a14be61c86 (0.8.5). This fixes #783 on Github.
* Modules: introduced QuickJS engine.Dmitry Volyntsev2024-09-17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | "js_engine" directive is introduced which sets JavaScript engine. When the module is built with QuickJS library "js_engine qjs;" sets QuickJS engine for the current block. By default njs engine is used. For example, nginx.conf: location /a { js_engine qjs; # will be handled by QuickJS js_content main.handler; } location /b { # will be handled by njs js_content main.handler; } QuickJS engine implements drop-in replacement for nginx/njs objects with the following exceptions: * nginx module API to be added later: ngx.fetch(), ngx.shared.dict. * Built-in modules to be added later: fs, crypto, WebCrypto, xml. * NJS specific API: njs.dump(), njs.on(), console.dump(). * js_preload_object directive.
* Modules: introduced engine API.Dmitry Volyntsev2024-09-17
| | | | No functional changes.
* Modules: added nocache flag for js_set variables.Thomas P.2024-08-23
| | | | | | | | | | This commit adds support for an additional `nocache` flag in `js_set` directives. If set, the resulting nginx variable will have no_cacheable set to 1. This enables us to dynamically recompute a variable if the context changed (for example, in case of an internal redirection). In case of multiple calls in a location, users should cache the result in a rewrite variable: `set $cached_variable $js_variable;`
* HTTP: expose capture group variables.Thomas P.2024-08-15
|
* Modules: removed non needed argument from meta handlers.Dmitry Volyntsev2024-07-25
|
* HTTP: moving ngx_http_methods table out of subrequest() method.Dmitry Volyntsev2024-07-18
| | | | So it can be reused by QuickJS code.
* HTTP: making ngx_http_js_header_t handler type generic.Dmitry Volyntsev2024-07-18
| | | | So it can be reused by QuickJS code.
* HTTP: simplifed r.subrequest() code.Dmitry Volyntsev2024-07-01
| | | | | Moving promise callbacks from ctx->promise_callbacks to the arguments of ngx_js_event_t.
* HTTP: simplified check for subrequest from a subrequest.Dmitry Volyntsev2024-06-28
|
* HTTP: fixed r.subrequest() error handling.Dmitry Volyntsev2024-06-12
| | | | | | | | | | Previously, when at least 2 subrequests were scheduled they both succeed, but the callback for the second threw an exception heap-use-after-free happened: a nested chain of ngx_http_run_posted_requests() calls and terminating request in the inner call left outer calls with already freed request pointer. The issue was introduced in 0.8.1 (4cb8e873e8c6).
* Change: removed byte strings API.Dmitry Volyntsev2024-05-17
| | | | | | | | | | | | | These functions are unsafe because they produce byte strings. Byte strings may not work as expected with the existing JS methods. The following functions were removed: - njs_vm_value_string_set() use njs_vm_value_string_create() as a drop-in replacement. - njs_vm_value_string_alloc() use njs_chb_t and njs_vm_value_string_create_chb() instead. This fixes #710 on Github.
* Modules: improved checking for duplicate js_set variables.Dmitry Volyntsev2024-04-22
| | | | | | | | | | | Since 6fb1aca4eeaf (0.8.4) the identical js_set variables introduced as a part of an include file that is shared amongst multiple vhosts are rejected during configuration parsing. The patch ignores duplicate js_set variables when they refer to the same JS function. This fixes #705 issue on Github.
* HTTP: fixed r.send() with Buffer argument.Dmitry Volyntsev2024-04-08
| | | | | | Previously, only string value type was accepted. This closes #701 issue on Github.
* Modules: checking for duplicate js_set variables.Dmitry Volyntsev2024-04-08
| | | | This closes #700 issue on Github.
* HTTP: validating URI and args arguments in r.subrequest().Dmitry Volyntsev2024-04-02
|
* Fixed typo introduced in eb01434865d7.Dmitry Volyntsev2024-03-05
|
* HTTP: allowing to set Server header.Dmitry Volyntsev2024-02-29
|
* HTTP: fixed stub_status statistic when js_periodic is enabled.Dmitry Volyntsev2024-01-31
| | | | | | | | | Previously, when js_periodic is enabled the Reading statistic was growing each time the js_periodic handler was called. The issue was introduced in f1bd0b1db065 (0.8.1). This fixes #692 issue on Github.
* Moving out HostPromiseRejectionTracker from njs core.Dmitry Volyntsev2024-01-18
| | | | | | | | HostPromiseRejectionTracker should be implemented by host environment according to ECMAScript specs. The following method was removed: njs_vm_unhandled_rejection(). The following method was introduced: njs_vm_set_rejection_tracker().
* HTTP: avoiding arithmetic ops with NULL pointer in r.args getter.Dmitry Volyntsev2024-01-11
| | | | Found by UndefinedBehaviorSanitizer.
* Moving out logger from njs core.Dmitry Volyntsev2023-12-14
| | | | | Logger is not part of the JS runtime according to ECMAScript and should be implemented by host environment.
* Introduced njs_vm_set_module_loader().Dmitry Volyntsev2023-12-13
|
* Refactored asynchronous events.Dmitry Volyntsev2023-12-05
| | | | | | | | | | | | | To align njs with other JS engines, async events are removed from njs core. The following functions were removed: njs_vm_add_event(), njs_vm_del_event(), njs_vm_waiting(). Instead the host is expected to manage async events by itself. In addition, the posted events are renamed to jobs, to better align with the ECMA specs. The following methods are removed: njs_vm_run(). Instead, the host is expected to call njs_vm_execute_pending_job() in a loop to execute pending jobs. The following functions were added: njs_vm_enqueue_job().
* Moving out setTimeout() and clearTimeout() from njs core.Dmitry Volyntsev2023-11-21
| | | | | This functions are not part of the ECMAScript and should be implemented by host environment.
* Renaming ngx_js_retval() to ngx_js_exception().Dmitry Volyntsev2023-11-21
| | | | | After previous commit ngx_js_retval() is only used for getting the exception value and should be renamed to better reflect the purpose.
* Modules: fixed js_set with Buffer values.Dmitry Volyntsev2023-11-21
| | | | | | | | | Previously, a Buffer value which contains invalid UTF-8 when returned as a value for js_set handler was mangled because the bytes value was converted to a string value. The fix is to use bytes value of Buffer, TypedArray and ArrayBuffer as is, and not convert it to a string first.
* Modules: added debug log for vm cloning and destroying.Dmitry Volyntsev2023-09-22
|