]>
git.kaiwu.me - njs.git/log
Dmitry Volyntsev [Fri, 13 Jun 2025 00:20:07 +0000 (17:20 -0700)]
Fixed handling of detached buffer for typed arrays.
Dmitry Volyntsev [Thu, 12 Jun 2025 22:34:39 +0000 (15:34 -0700)]
Fixed %TypedArray%.prototype.slice() with overlapping buffers.
Dmitry Volyntsev [Thu, 12 Jun 2025 22:16:41 +0000 (15:16 -0700)]
Fixed %TypedArray%.from() with buffer is detached by mapper.
Orgad Shaneh [Mon, 9 Jun 2025 13:59:22 +0000 (16:59 +0300)]
Removed NGX_MAX_PATH define.
Already defined in ngx_files.h (included from ngx_core.h).
Dmitry Volyntsev [Thu, 5 Jun 2025 06:07:11 +0000 (23:07 -0700)]
Fixed compilation with old gcc.
This fixed compilation issues with gcc-4.1.
Dmitry Volyntsev [Thu, 5 Jun 2025 05:54:54 +0000 (22:54 -0700)]
Fixed constant is too large for 'long' warning on mips -mabi=n32.
Prodded by Orgad Shaneh.
Dmitry Volyntsev [Tue, 3 Jun 2025 02:08:27 +0000 (19:08 -0700)]
Fixed gcc compilation with O3 optimization level.
Dmitry Volyntsev [Wed, 4 Jun 2025 05:37:32 +0000 (22:37 -0700)]
Improved README.md clarity with angle bracket explanations.
Dmitry Volyntsev [Tue, 3 Jun 2025 00:18:22 +0000 (17:18 -0700)]
Fixed Function constructor template injection.
The Function constructor uses a `(function(<args>) {<body>})` template
to construct new functions. This approach was vulnerable to template
injection where malicious code could close the function body early.
This fixes issue #921.
Vadim Zhestikov [Wed, 28 May 2025 16:16:38 +0000 (09:16 -0700)]
Fixed segfault at error message in njs_property_query().
The issue was introduced in
b28e50b1 (0.9.0).
This closes #918 issue on Github.
Dmitry Volyntsev [Thu, 22 May 2025 00:10:15 +0000 (17:10 -0700)]
QuickJS: added memory limit check for reuse queue.
Dmitry Volyntsev [Thu, 15 May 2025 01:16:15 +0000 (18:16 -0700)]
Modules: added state file for the shared dictionary.
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.
Dmitry Volyntsev [Fri, 16 May 2025 00:24:25 +0000 (17:24 -0700)]
Modules: engine independent method to add entries to a shared dict.
Dmitry Volyntsev [Fri, 16 May 2025 00:01:25 +0000 (17:01 -0700)]
Modules: replaced njs_str_t with ngx_str_t in the shared dictionary.
This is a preparatory patch for upcoming changes to unify common code
for njs and QuickJS engines.
Dmitry Volyntsev [Thu, 15 May 2025 02:36:33 +0000 (19:36 -0700)]
Modules: introduced NGX_CHB_CTX_INIT().
Dmitry Volyntsev [Thu, 15 May 2025 01:00:23 +0000 (18:00 -0700)]
Modules: separating different init worker components.
Dmitry Volyntsev [Tue, 20 May 2025 01:53:00 +0000 (18:53 -0700)]
Tests: removed leftover engine checks.
Dmitry Volyntsev [Mon, 19 May 2025 21:58:12 +0000 (14:58 -0700)]
WebCrypto: fixed issue introduced in
637fc26e .
Found by Clang static analyzer.
Dmitry Volyntsev [Wed, 14 May 2025 02:08:16 +0000 (19:08 -0700)]
WebCrypto: improved working with curve constants.
In crypto.subtle.generateKey().
Dmitry Volyntsev [Fri, 9 May 2025 00:13:01 +0000 (17:13 -0700)]
WebCrypto: added ECDH support.
Dmitry Volyntsev [Fri, 9 May 2025 01:03:21 +0000 (18:03 -0700)]
WebCrypto: making SHA-256 the default hash algorithm.
Dmitry Sviridkin [Thu, 15 May 2025 12:55:13 +0000 (13:55 +0100)]
Add missing null checks for promise code.
Zhidao HONG [Tue, 22 Apr 2025 02:56:27 +0000 (10:56 +0800)]
Fetch: QuickJS support.
Zhidao HONG [Mon, 21 Apr 2025 17:09:15 +0000 (01:09 +0800)]
Fetch: unify string type to support both njs and QuickJS.
Zhidao HONG [Mon, 21 Apr 2025 17:04:31 +0000 (01:04 +0800)]
Fetch: separated ngx_js_http_* from ngx_js_fetch_*.
Dmitry Volyntsev [Thu, 8 May 2025 03:49:21 +0000 (20:49 -0700)]
WebCrypto: fixed extractable handling for crypto.subtle.deriveKey().
Dmitry Volyntsev [Thu, 8 May 2025 02:11:24 +0000 (19:11 -0700)]
WebCrypto: added support for HMAC as derivedKeyAlgorithm.
In crypto.subtle.deriveKey().
This closes #905 issue on Github.
Dmitry Volyntsev [Thu, 8 May 2025 16:25:24 +0000 (09:25 -0700)]
Version bump.
Vadim Zhestikov [Mon, 5 May 2025 19:38:32 +0000 (12:38 -0700)]
Version 0.9.0.
Dmitry Volyntsev [Mon, 5 May 2025 15:53:19 +0000 (08:53 -0700)]
HTTP: fixed GCC 15 build with -Wunterminated-string-initialization.
ngx_http_js_module.c:936:22: error: initializer-string for array of ‘char’ truncates NUL terminator
but destination lacks ‘nonstring’ attribute (16 chars into 15 available) [-Werror=unterminated-string-initialization]
936 | .value = "PeriodicSession",
| ^~~~~~~~~~~~~~~~~
Dmitry Volyntsev [Fri, 2 May 2025 00:05:56 +0000 (17:05 -0700)]
Fixed GCC 15 build with -Wunterminated-string-initialization.
In file included from src/njs_main.h:48,
from src/njs_diyfp.c:12:
src/njs_string.h: In function ‘njs_string_encode’:
src/njs_string.h:229:36: error: initializer-string for array of ‘unsigned char’
truncates NUL terminator but destination lacks ‘nonstring’ attribute (
17 chars into 16 available) [-Werror=unterminated-string-initialization]
229 | static const u_char hex[16] = "
0123456789ABCDEF ";
Dmitry Volyntsev [Thu, 1 May 2025 16:06:25 +0000 (09:06 -0700)]
Tests: fixed js_body_filter.t.
The
1496ed3f commit made visible a problem with the fragile filter tests
which depend on the exact sequence of data chunks. The fix is to use
perl http server to ensure the order.
Vadim Zhestikov [Wed, 30 Apr 2025 21:20:31 +0000 (14:20 -0700)]
Fixed regexp undefined value of captured group.
Found by OSS-Fuzz.
Dmitry Volyntsev [Thu, 1 May 2025 01:32:39 +0000 (18:32 -0700)]
Using invalid UTF-8 string as atom number 0.
This prevents a clash with possible valid UTF-8 strings.
Dmitry Volyntsev [Thu, 1 May 2025 01:23:20 +0000 (18:23 -0700)]
Fixed building with --debug=YES after
b28e50b1 .
In file included from src/njs_main.h:37,
from src/njs_diyfp.c:12:
src/njs_atom.h: In function ‘njs_atom_to_value’:
src/njs_atom.h:54:31: error: invalid use of incomplete typedef
‘njs_flathsh_descr_t’ {aka ‘struct njs_flathsh_descr_s’}
54 | njs_assert(atom_id < h->elts_count);
| ^~
src/njs_assert.h:14:15: note: in definition of macro ‘njs_assert’
Dmitry Volyntsev [Tue, 29 Apr 2025 01:34:29 +0000 (18:34 -0700)]
Tests: improved js_body_filter.t tests.
Dropping Content-Length header in locations where response body
length is modified. This is not strictly needed for the test itself,
but can serve as an example for a typical body modification task.
Dmitry Volyntsev [Tue, 29 Apr 2025 01:28:08 +0000 (18:28 -0700)]
Tests: fixed js_body_filter.t tests.
Previously, '|' was used incorrectly in test match pattern.
Dmitry Volyntsev [Sat, 22 Mar 2025 05:52:55 +0000 (22:52 -0700)]
Introduced NJS_VMCODE_PROPERTY_ATOM_SET instruction.
Dmitry Volyntsev [Wed, 26 Mar 2025 07:23:23 +0000 (00:23 -0700)]
Introduced NJS_VMCODE_PROPERTY_ATOM_GET instruction.
Vadim Zhestikov [Thu, 29 Aug 2024 05:03:14 +0000 (22:03 -0700)]
Refactored working with built-in strings, symbols and small integers.
- 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.
Dmitry Volyntsev [Mon, 21 Apr 2025 16:41:46 +0000 (09:41 -0700)]
Test262: fixed mktemp format on OpenBSD.
mktemp: insufficient number of Xs in template `/tmp/njs_test.XXX'
Zhidao HONG [Mon, 21 Apr 2025 15:37:49 +0000 (23:37 +0800)]
Replaced vm with mp in NJS_CHB_MP_INIT().
Zhidao HONG [Fri, 11 Apr 2025 14:43:31 +0000 (22:43 +0800)]
Fetch: refactored out ngx_js_http_resolve().
Zhidao HONG [Fri, 11 Apr 2025 14:02:16 +0000 (22:02 +0800)]
Fetch: refactored out ngx_js_http_close_peer().
Zhidao HONG [Fri, 11 Apr 2025 13:59:16 +0000 (21:59 +0800)]
Fetch: refactored out ngx_js_http_resolve_done().
Zhidao HONG [Fri, 11 Apr 2025 13:57:02 +0000 (21:57 +0800)]
Fetch: renamed njs_js_http_destructor() as ngx_js_http_destructor().
Zhidao HONG [Fri, 11 Apr 2025 13:47:52 +0000 (21:47 +0800)]
Fetch: generalize ngx_js_http_error().
Refactored to support both njs and QuickJS, which have different error
formats when throwing exceptions.
Zhidao HONG [Tue, 8 Apr 2025 15:00:42 +0000 (23:00 +0800)]
Fetch: remove unused parameter in ngx_js_http_error().
No functional changes.
Dmitry Volyntsev [Thu, 10 Apr 2025 00:19:37 +0000 (17:19 -0700)]
Fixed typo in stream event handler debug message.
Dmitry Volyntsev [Thu, 10 Apr 2025 00:18:53 +0000 (17:18 -0700)]
Version bump.
Dmitry Volyntsev [Tue, 8 Apr 2025 01:53:52 +0000 (18:53 -0700)]
Version 0.8.10.
Dmitry Volyntsev [Tue, 8 Apr 2025 01:28:50 +0000 (18:28 -0700)]
QuickJS: ignoring rejected promises while destroying context.
Dmitry Volyntsev [Thu, 3 Apr 2025 00:47:10 +0000 (17:47 -0700)]
QuickJS: added xml to nginx modules.
Missed in
cec9a1650 .
Zhidao HONG [Thu, 3 Apr 2025 03:44:57 +0000 (11:44 +0800)]
QuickJS: fix exception handling during configuration phase.
The issue was introduced in
9010aee (not released yet).
Zhidao HONG [Sat, 29 Mar 2025 14:02:19 +0000 (22:02 +0800)]
QuickJS: fixed ngx_qjs_external_resolver().
Dmitry Volyntsev [Thu, 27 Mar 2025 05:13:22 +0000 (22:13 -0700)]
QuickJS: fixed compatibility issues with QuickJS-NG 0.9.0.
This fixes #872 on Github.
Dmitry Volyntsev [Tue, 18 Mar 2025 23:22:53 +0000 (16:22 -0700)]
QuickJS: added xml module.
Dmitry Volyntsev [Tue, 4 Mar 2025 01:07:59 +0000 (17:07 -0800)]
XML: allowing to remove the property $text for XMLNode.
Dmitry Volyntsev [Thu, 27 Feb 2025 06:12:31 +0000 (22:12 -0800)]
XML: fixed serializeToString().
Previously, serializeToString() was exclusiveC14n() which returned
string instead of Buffer. According to the published documentation it
should be c14n().
Dmitry Volyntsev [Wed, 26 Feb 2025 07:05:31 +0000 (23:05 -0800)]
Test262: improved compatibility with node.js for fs/methods.t.mjs.
Dmitry Volyntsev [Wed, 26 Mar 2025 00:08:09 +0000 (17:08 -0700)]
QuickJS: fixed compatibility with recent change in upstream.
JS_VALUE_GET_OBJ(v) was made hidden in
156d981 .
Dmitry Volyntsev [Tue, 25 Mar 2025 00:39:06 +0000 (08:39 +0800)]
QuickJS: introduced qjs_promise_result().
hongzhidao [Mon, 24 Mar 2025 07:40:15 +0000 (15:40 +0800)]
QuickJS: added missed JS_NewClass() for the SharedDictError class.
Vadim Zhestikov [Wed, 19 Mar 2025 16:12:45 +0000 (09:12 -0700)]
QuickJS: using JS_AddIntrinsicBigInt() if detected.
hongzhidao [Tue, 18 Mar 2025 13:34:59 +0000 (21:34 +0800)]
QuickJS: calling njs_chb_destroy() in qjs_string_create_chb() internally.
No functional changes.
hongzhidao [Wed, 19 Mar 2025 05:47:07 +0000 (13:47 +0800)]
QuickJS: fixed ngx_qjs_string() to handle strings containing "\0".
hongzhidao [Wed, 19 Mar 2025 03:18:41 +0000 (11:18 +0800)]
QuickJS: fixed njs_qjs_object_completions().
This commit also exposed qjs_free_prop_enum() as public.
Vadim Zhestikov [Tue, 18 Mar 2025 17:40:24 +0000 (10:40 -0700)]
QuickJS: added error checks in modules initialization.
Vadim Zhestikov [Thu, 6 Mar 2025 02:54:41 +0000 (18:54 -0800)]
QuickJS: crypto module.
Dmitry Volyntsev [Wed, 26 Feb 2025 06:44:39 +0000 (22:44 -0800)]
Test262: allowing to omit empty default option argument.
Dmitry Volyntsev [Wed, 26 Feb 2025 06:35:55 +0000 (22:35 -0800)]
Test262: using default prepare_args() where appropriate.
hongzhidao [Mon, 17 Mar 2025 06:40:49 +0000 (14:40 +0800)]
QuickJS: making ngx_qjs_*() functions consistent with ngx_js_*().
Dmitry Volyntsev [Thu, 6 Feb 2025 00:47:03 +0000 (16:47 -0800)]
QuickJS: using helper to declare Symbol.toStringTag properties.
Dmitry Volyntsev [Thu, 6 Feb 2025 00:26:40 +0000 (16:26 -0800)]
QuickJS: removed unused variable casts introduced in
75ca26f .
These casts were added to suppress compiler warnings during development
but are no longer needed.
Dmitry Volyntsev [Sat, 22 Feb 2025 07:03:46 +0000 (23:03 -0800)]
Fetch: accepting response headers with underscore characters.
This fixes #856 on Github.
Dmitry Volyntsev [Sat, 22 Feb 2025 06:54:00 +0000 (22:54 -0800)]
Tests: making fetch test portable by removing njs.dump().
Dmitry Volyntsev [Sat, 22 Feb 2025 06:10:07 +0000 (22:10 -0800)]
Fixed typo introduced in
75ca26f .
Dmitry Volyntsev [Sat, 22 Feb 2025 04:40:14 +0000 (20:40 -0800)]
Modules: improved reporting of unhandled promise rejections.
Previously, some promise rejections were not reported.
For example:
async function timeout(ms) {
return new Promise((resolve, reject) => {
setTimeout(() => {
reject(new Error('timeout'));
}, ms);
});
}
async function handler(r) {
let v = await timeout(1000);
r.return(200);
}
Dmitry Volyntsev [Wed, 19 Feb 2025 06:53:54 +0000 (22:53 -0800)]
Tests: splitting js_periodic tests into multiple files.
Dmitry Volyntsev [Thu, 20 Feb 2025 01:36:46 +0000 (17:36 -0800)]
QuickJS: fixed memory leak in js_periodic handler.
Dmitry Volyntsev [Thu, 20 Feb 2025 00:50:15 +0000 (16:50 -0800)]
QuickJS: fixed SharedDict.incr() with empty init argument.
Dmitry Volyntsev [Thu, 13 Feb 2025 02:07:26 +0000 (18:07 -0800)]
QuickJS: added WebCrypto import tests forgotten in
75ca26f .
Import related tests are consolidated from other WebCrypto tests.
Dmitry Volyntsev [Thu, 13 Feb 2025 02:13:54 +0000 (18:13 -0800)]
QuickJS: added missed OPENSSL context for errors in WebCrypto.
Dmitry Volyntsev [Thu, 13 Feb 2025 02:12:38 +0000 (18:12 -0800)]
QuickJS: fixed key usage processing with invalid values in WebCrypto.
Dmitry Volyntsev [Thu, 13 Feb 2025 03:11:08 +0000 (19:11 -0800)]
QuickJS: fixed non-NULL terminated strings formatting in exceptions.
When "%*s" is specified, the first integer is interpreted as width.
Width specifies *minimum* number of characters to output. The next
string is expected to be NULL-terminated.
When "%.*s" is specified, the first integer is interpreted as precision.
Precision specifies *maximum* number of characters to output.
Dmitry Volyntsev [Wed, 12 Feb 2025 00:41:56 +0000 (16:41 -0800)]
Fixed access to uninitialized alg in SubtleCrypto.import().
Found by GCC:
In function ‘qjs_import_jwk_oct’,
external/qjs_webcrypto_module.c:3116:13: error: ‘alg.start’ may be used uninitialized [-Werror=maybe-uninitialized]
3116 | JS_ThrowTypeError(cx, "key size and \"alg\" value \"%s\" mismatch",
The similar place in the NJS module was also fixed.
Vadim Zhestikov [Tue, 11 Feb 2025 23:39:29 +0000 (15:39 -0800)]
Add missed syntax error for await in template literal.
This fixes issues #836 on github.
Dmitry Volyntsev [Sat, 8 Feb 2025 01:23:09 +0000 (17:23 -0800)]
Modules: fixed name corruption in variable and header processing.
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.
Dmitry Volyntsev [Thu, 30 Jan 2025 05:35:08 +0000 (21:35 -0800)]
QuickJS: added querystring module.
Dmitry Volyntsev [Mon, 3 Feb 2025 17:07:22 +0000 (09:07 -0800)]
QuickJS: fixed shared dict in stream module.
The change was missed in
352c2e59 (0.8.8).
Dmitry Volyntsev [Fri, 31 Jan 2025 03:10:29 +0000 (19:10 -0800)]
Tests262: fixed merge() with null values.
Dmitry Volyntsev [Wed, 29 Jan 2025 03:11:48 +0000 (19:11 -0800)]
HTTP: reading r.requestText or r.requestBuffer from a temp file.
Previously, an exception was thrown when accessing r.requestText or
r.requestBuffer if a client request body size exceeded
client_body_buffer_size.
Dmitry Volyntsev [Fri, 10 Jan 2025 03:25:58 +0000 (19:25 -0800)]
QuickJS: added WebCrypto module.
Dmitry Volyntsev [Thu, 23 Jan 2025 02:03:55 +0000 (18:03 -0800)]
CI: added test with QuickJS-NG in check-pr job.
Dmitry Volyntsev [Wed, 22 Jan 2025 01:09:06 +0000 (17:09 -0800)]
QuickJS: added support for QuickJS-NG library.
Dmitry Volyntsev [Thu, 23 Jan 2025 01:44:11 +0000 (17:44 -0800)]
QuickJS: correctly handling value len for empty query params.
Dmitry Volyntsev [Wed, 22 Jan 2025 02:07:53 +0000 (18:07 -0800)]
QuickJS: reimplemented process.argv.
Without using JS_SetOpaque(), because in QuickJS-NG opaque pointer
cannot be set for internal classes, including ordinary objects.
Dmitry Volyntsev [Thu, 23 Jan 2025 23:45:43 +0000 (15:45 -0800)]
Version bump.
Dmitry Volyntsev [Fri, 17 Jan 2025 01:36:44 +0000 (17:36 -0800)]
QuickJS: fixed Buffer.concat() with a single argument.
Dmitry Volyntsev [Sat, 11 Jan 2025 07:20:36 +0000 (23:20 -0800)]
QuickJS: added TextDecoder and TextEncoder.