ports/www/unit/files/patch-src_nxt__js.c
Sergey A. Osokin 563db0f94e */*unit*: update NGINX Unit: 1.31.1 -> 1.32.0
<ChangeLog>

*) Feature: WebAssembly Components using WASI interfaces defined in
   wasi:http/proxy@0.2.0.

*) Feature: conditional access logging.

*) Feature: NJS variables access.

*) Feature: $request_id variable contains a string that is formed using
   random data and can be used as a unique request identifier.

*) Feature: options to set control socket permissions.

*) Feature: Ruby arrays in response headers, improving compatibility
   with Rack v3.0.

*) Feature: Python bytearray response bodies for ASGI applications.

*) Bugfix: router could crash while sending large files. Thanks to
   rustedsword.

*) Bugfix: serving static files from a network filesystem could lead to
   error.

*) Bugfix: "uidmap" and "gidmap" isolation options validation.

*) Bugfix: abstract UNIX socket name could be corrupted during
   configuration validation. Thanks to Alejandro Colomar.

*) Bugfix: HTTP header field value encoding could be misinterpreted in
   Python module.

*) Bugfix: Node.js http.createServer() accepts and ignores the "options"
   argument, improving compatibility with strapi applications, among
   others.

*) Bugfix: ServerRequest.flushHeaders() implemented in Node.js module to
   make it compatible with Next.js.

*) Bugfix: ServerRequest.httpVersion variable format in Node.js module.

*) Bugfix: Node.js module handles standard library imports prefixed with
   "node:", making it possible to run newer Nuxt applications, among
   others.

*) Bugfix: Node.js tarball location changed to avoid build/install
   errors.

*) Bugfix: Go module sets environment variables necessary for building
   on macOS/arm64 systems.

</ChangeLog>
2024-03-18 10:46:50 -04:00

48 lines
944 B
C

--- src/nxt_js.c.orig 2023-10-17 14:15:38 UTC
+++ src/nxt_js.c
@@ -69,14 +69,6 @@ nxt_js_module_loader(njs_vm_t *vm, njs_external_ptr_t
}
-static njs_vm_ops_t nxt_js_ops = {
- NULL,
- NULL,
- nxt_js_module_loader,
- NULL,
-};
-
-
njs_int_t nxt_js_proto_id;
@@ -127,6 +119,7 @@ nxt_js_vm_create(nxt_js_conf_t *jcf)
{
u_char *p;
size_t size;
+ njs_vm_t *vm;
nxt_uint_t i;
njs_vm_opt_t opts;
nxt_js_module_t *module, *mod;
@@ -146,7 +139,6 @@ nxt_js_vm_create(nxt_js_conf_t *jcf)
goto done;
}
- opts.ops = &nxt_js_ops;
opts.external = jcf;
size = 0;
@@ -203,7 +195,13 @@ nxt_js_vm_create(nxt_js_conf_t *jcf)
done:
- return njs_vm_create(&opts);
+ vm = njs_vm_create(&opts);
+
+ if (nxt_fast_path(vm != NULL)) {
+ njs_vm_set_module_loader(vm, nxt_js_module_loader, jcf);
+ }
+
+ return vm;
}