From 30ba18e2a5f12cfd52d8ea1f732f4602a0ba4659 Mon Sep 17 00:00:00 2001 From: "Sergey A. Osokin" Date: Tue, 11 Jul 2023 22:15:02 -0400 Subject: [PATCH] */*: update NGINX JavaScript: 0.7.12 -> 0.8.0 (+) nginx modules: *) Change: removed special treatment of forbidden headers in Fetch API introduced in 0.7.10. *) Change: removed deprecated since 0.5.0 r.requestBody and r.responseBody in HTTP module. *) Change: throwing an exception in r.internalRedirect() while filtering in HTTP module. *) Feature: introduced global nginx properties. ngx.build - an optional nginx build name, corresponds to --build=name argument of configure script, by default is "". ngx.conf_file_path - the file path to current nginx configuration file. ngx.error_log_path - the file path to current error log file. ngx.prefix - the directory that keeps server files. ngx.version - the nginx version as a string, for example: "1.25.0". ngx.version_number - the nginx version as a number, for example: 1025000. ngx.worker_id - corresponds to an nginx internal worker id. The value is between 0 and worker_processes - 1. *) Feature: introduced js_shared_dict_zone directive. The directive allows to declare a dictionary that is shared among the working processes. *) Improvement: added compile-time options to disable njs modules. For example to disable libxslt related code: NJS_LIBXSLT=NO ./configure .. --add-module=/path/to/njs/module *) Bugfix: fixed r.status setter when filtering in HTTP module. *) Bugfix: fixed setting of Location header in HTTP module. Core: *) Change: native methods are provided with retval argument. This change breaks compatibility with C extension for njs requiring to modify the code. *) Change: non-compliant deprecated String methods were removed. The following methods were removed: String.bytesFrom(), String.prototype.fromBytes(), String.prototype.fromUTF8(), String.prototype.toBytes(), String.prototype.toUTF8(), String.prototype.toString(encoding). *) Change: removed support for building with GNU readline. *) Feature: added Array.from(), Array.prototype.toSorted(), Array.prototype.toSpliced(), Array.prototype.toReversed(). *) Feature: added %TypedArray%.prototype.toSorted(), %TypedArray%.prototype.toSpliced(), %TypedArray%.prototype.toReversed(). *) Feature: added CryptoKey properties in WebCrypto. The following properties for CryptoKey were added: algorithm, extractable, type, usages. *) Bugfix: fixed retval of crypto.getRandomValues(). *) Bugfix: fixed evaluation of computed property names with function expressions. *) Bugfix: fixed implicit name for a function expression declared in arrays. *) Bugfix: fixed parsing of for-in loops. *) Bugfix: fixed Date.parse() with ISO-8601 format and UTC time offset. --- devel/libnjs/Makefile | 3 +- devel/libnjs/distinfo | 6 +-- devel/libnjs/files/patch-auto_make | 22 +++----- devel/libnjs/files/patch-src_njs.pc.in | 13 +++++ lang/njs/Makefile | 2 +- lang/njs/distinfo | 6 +-- www/nginx-devel/Makefile | 5 +- www/nginx-devel/Makefile.extmod | 6 +-- www/nginx-devel/distinfo | 6 +-- www/unit/Makefile | 1 + www/unit/files/patch-src_nxt__js.c | 72 ++++++++++++++++++++++++++ 11 files changed, 111 insertions(+), 31 deletions(-) create mode 100644 devel/libnjs/files/patch-src_njs.pc.in create mode 100644 www/unit/files/patch-src_nxt__js.c diff --git a/devel/libnjs/Makefile b/devel/libnjs/Makefile index 39a1a022976a..a6ede4df4804 100644 --- a/devel/libnjs/Makefile +++ b/devel/libnjs/Makefile @@ -1,6 +1,5 @@ PORTNAME= libnjs -DISTVERSION= 0.7.12 -PORTREVISION= 1 +DISTVERSION= 0.8.0 CATEGORIES= devel www MAINTAINER= osa@FreeBSD.org diff --git a/devel/libnjs/distinfo b/devel/libnjs/distinfo index 7095c6bb428e..8ccb193ce347 100644 --- a/devel/libnjs/distinfo +++ b/devel/libnjs/distinfo @@ -1,3 +1,3 @@ -TIMESTAMP = 1681160351 -SHA256 (nginx-njs-0.7.12_GH0.tar.gz) = 7a75a39022dfb58dbf461053903a07cc48dd4942f7d82a46601819c1b0077687 -SIZE (nginx-njs-0.7.12_GH0.tar.gz) = 662554 +TIMESTAMP = 1688833591 +SHA256 (nginx-njs-0.8.0_GH0.tar.gz) = b98033fff6aadcbb8e108b96e80c0d94c6e2103bcbe75846b5ae0b560696084b +SIZE (nginx-njs-0.8.0_GH0.tar.gz) = 715391 diff --git a/devel/libnjs/files/patch-auto_make b/devel/libnjs/files/patch-auto_make index bcc24076ba99..5a7b66d1ad47 100644 --- a/devel/libnjs/files/patch-auto_make +++ b/devel/libnjs/files/patch-auto_make @@ -1,19 +1,13 @@ ---- auto/make.orig 2023-05-11 23:24:57 UTC +--- auto/make.orig 2023-07-11 23:27:41 UTC +++ auto/make -@@ -320,11 +320,11 @@ cat << END >> $NJS_MAKEFILE +@@ -320,9 +320,7 @@ cat << END >> $NJS_MAKEFILE pc: $NJS_BUILD_DIR/njs.pc $NJS_BUILD_DIR/njs.pc: $NJS_BUILD_DIR/njs_auto_config.h -- sed -e "s,@PREFIX@,$(pwd)/$NJS_BUILD_DIR," \\ -- -e "s,@LIBDIR@,$(pwd)/$NJS_BUILD_DIR," \\ -- -e "s,@CFLAGS@,-I$(pwd)/$NJS_BUILD_DIR -I$(pwd)/src," \\ -- -e "s,@VERSION@,\$(NJS_VER)," \\ -- -e "s,@EXTRA_LIBS@,-lm $NJS_LIBS $NJS_LIB_AUX_LIBS," \\ -+ sed -e "s|@PREFIX@|$(pwd)/$NJS_BUILD_DIR|" \\ -+ -e "s|@LIBDIR@|$(pwd)/$NJS_BUILD_DIR|" \\ -+ -e "s|@CFLAGS@|-I$(pwd)/$NJS_BUILD_DIR -I$(pwd)/src|" \\ -+ -e "s|@VERSION@|\$(NJS_VER)|" \\ -+ -e "s|@EXTRA_LIBS@|-lm $NJS_LIBS $NJS_LIB_AUX_LIBS|" \\ +- sed -e "s#@PREFIX@#$(pwd)/$NJS_BUILD_DIR#" \\ +- -e "s#@LIBDIR@#$(pwd)/$NJS_BUILD_DIR#" \\ +- -e "s#@CFLAGS@#-I$(pwd)/$NJS_BUILD_DIR -I$(pwd)/src#" \\ ++ sed -e "s#@PREFIX@#%%LOCALBASE%%#" \\ + -e "s#@VERSION@#\$(NJS_VER)#" \\ + -e "s#@EXTRA_LIBS@#-lm $NJS_LIBS $NJS_LIB_AUX_LIBS#" \\ src/njs.pc.in > \$@ - END - diff --git a/devel/libnjs/files/patch-src_njs.pc.in b/devel/libnjs/files/patch-src_njs.pc.in new file mode 100644 index 000000000000..1a85733f9e9d --- /dev/null +++ b/devel/libnjs/files/patch-src_njs.pc.in @@ -0,0 +1,13 @@ +--- src/njs.pc.in.orig 2023-07-11 23:13:20 UTC ++++ src/njs.pc.in +@@ -1,8 +1,8 @@ + prefix=@PREFIX@ +-libdir=@LIBDIR@ ++libdir=${prefix}/lib + + Name: njs + Description: library to embed njs scripting language + Version: @VERSION@ + Libs: -L${libdir} -lnjs @EXTRA_LIBS@ +-Cflags: @CFLAGS@ ++Cflags: -I${prefix}/include diff --git a/lang/njs/Makefile b/lang/njs/Makefile index 88e9a3c0bd03..bf164be364d3 100644 --- a/lang/njs/Makefile +++ b/lang/njs/Makefile @@ -1,5 +1,5 @@ PORTNAME= njs -DISTVERSION= 0.7.12 +DISTVERSION= 0.8.0 CATEGORIES= lang www MAINTAINER= osa@FreeBSD.org diff --git a/lang/njs/distinfo b/lang/njs/distinfo index 84648dc73ec7..ed576717150e 100644 --- a/lang/njs/distinfo +++ b/lang/njs/distinfo @@ -1,3 +1,3 @@ -TIMESTAMP = 1681160550 -SHA256 (nginx-njs-0.7.12_GH0.tar.gz) = 7a75a39022dfb58dbf461053903a07cc48dd4942f7d82a46601819c1b0077687 -SIZE (nginx-njs-0.7.12_GH0.tar.gz) = 662554 +TIMESTAMP = 1689100616 +SHA256 (nginx-njs-0.8.0_GH0.tar.gz) = b98033fff6aadcbb8e108b96e80c0d94c6e2103bcbe75846b5ae0b560696084b +SIZE (nginx-njs-0.8.0_GH0.tar.gz) = 715391 diff --git a/www/nginx-devel/Makefile b/www/nginx-devel/Makefile index 0d66c490df2f..fe72cee17917 100644 --- a/www/nginx-devel/Makefile +++ b/www/nginx-devel/Makefile @@ -1,6 +1,6 @@ PORTNAME?= nginx PORTVERSION= 1.25.1 -PORTREVISION= 1 +PORTREVISION= 2 CATEGORIES= www MASTER_SITES= https://nginx.org/download/ \ LOCAL/osa @@ -249,7 +249,8 @@ CONFIGURE_ARGS+= --with-ld-opt="-L ${LOCALBASE}/lib -lpcre" LIB_DEPENDS+= libpcre.so:devel/pcre .endif -.if empty(PORT_OPTIONS:MNJS_XML) +.if ${PORT_OPTIONS:MNJS} && empty(PORT_OPTIONS:MNJS_XML) +CONFIGURE_ENV+= NJS_LIBXSLT=NO NJS_CONFIGURE_ARGS= --no-libxml2 .endif diff --git a/www/nginx-devel/Makefile.extmod b/www/nginx-devel/Makefile.extmod index ee1d035eb47f..6ef47d920908 100644 --- a/www/nginx-devel/Makefile.extmod +++ b/www/nginx-devel/Makefile.extmod @@ -236,12 +236,12 @@ NAXSI_GH_TUPLE= nbs-system:naxsi:${NAXSI_NGINX_VER}:naxsi NAXSI_VARS= DSO_EXTMODS+=naxsi NAXSI_SUBDIR=/naxsi_src NAXSI_EXTRA_PATCHES= ${PATCHDIR}/extra-patch-naxsi_runtime.c -NJS_GH_TUPLE= nginx:njs:0.7.12:njs +NJS_GH_TUPLE= nginx:njs:0.8.0:njs NJS_VARS= DSO_EXTMODS+=njs NJS_SUBDIR=/nginx -NJS_USES= libedit NJS_XML_IMPLIES= NJS -NJS_XML_LIB_DEPENDS= libxml2.so:textproc/libxml2 +NJS_XML_LIB_DEPENDS= libxml2.so:textproc/libxml2 \ + libxslt.so:textproc/libxslt OPENTRACING_GH_TUPLE= opentracing-contrib:nginx-opentracing:v0.24.0:opentracing OPENTRACING_LIB_DEPENDS= libopentracing.so:devel/libopentracing diff --git a/www/nginx-devel/distinfo b/www/nginx-devel/distinfo index 88e2a46c53e7..a265baf0a3ae 100644 --- a/www/nginx-devel/distinfo +++ b/www/nginx-devel/distinfo @@ -1,4 +1,4 @@ -TIMESTAMP = 1688165378 +TIMESTAMP = 1689101193 SHA256 (nginx-1.25.1.tar.gz) = f09071ac46e0ea3adc0008ef0baca229fc6b4be4533baef9bbbfba7de29a8602 SIZE (nginx-1.25.1.tar.gz) = 1213919 SHA256 (nginx_mogilefs_module-1.0.4.tar.gz) = 7ac230d30907f013dff8d435a118619ea6168aa3714dba62c6962d350c6295ae @@ -105,8 +105,8 @@ SHA256 (SpiderLabs-ModSecurity-nginx-v1.0.3_GH0.tar.gz) = 32a42256616cc674dca24c SIZE (SpiderLabs-ModSecurity-nginx-v1.0.3_GH0.tar.gz) = 34063 SHA256 (nbs-system-naxsi-29793dc_GH0.tar.gz) = 579df0e50ff32464f7bb152df9d93ea18c05c4aa3966ec4d8c603b5dd629be08 SIZE (nbs-system-naxsi-29793dc_GH0.tar.gz) = 236932 -SHA256 (nginx-njs-0.7.12_GH0.tar.gz) = 7a75a39022dfb58dbf461053903a07cc48dd4942f7d82a46601819c1b0077687 -SIZE (nginx-njs-0.7.12_GH0.tar.gz) = 662554 +SHA256 (nginx-njs-0.8.0_GH0.tar.gz) = b98033fff6aadcbb8e108b96e80c0d94c6e2103bcbe75846b5ae0b560696084b +SIZE (nginx-njs-0.8.0_GH0.tar.gz) = 715391 SHA256 (opentracing-contrib-nginx-opentracing-v0.24.0_GH0.tar.gz) = 5328c5f37e0615b5252aed51b9cd40f3d14989d995ad54134076aeda4ab9b280 SIZE (opentracing-contrib-nginx-opentracing-v0.24.0_GH0.tar.gz) = 679417 SHA256 (konstruxi-ngx_postgres-8aa7359_GH0.tar.gz) = c69ad4495de7c7883ebc23e1e6c4cc83a4ac6a7fddd4d5c12e49d33b65f7c50b diff --git a/www/unit/Makefile b/www/unit/Makefile index 018e336e7b0f..d283d5a06a57 100644 --- a/www/unit/Makefile +++ b/www/unit/Makefile @@ -1,5 +1,6 @@ PORTNAME= unit PORTVERSION= ${UNIT_VERSION} +PORTREVISION= 1 CATEGORIES= www MASTER_SITES?= https://unit.nginx.org/download/ diff --git a/www/unit/files/patch-src_nxt__js.c b/www/unit/files/patch-src_nxt__js.c new file mode 100644 index 000000000000..bd7ba596126d --- /dev/null +++ b/www/unit/files/patch-src_nxt__js.c @@ -0,0 +1,72 @@ +--- src/nxt_js.c.orig 2023-05-10 16:22:28 UTC ++++ src/nxt_js.c +@@ -386,11 +386,11 @@ nxt_js_call(nxt_task_t *task, nxt_js_conf_t *jcf, nxt_ + nxt_js_t *js, nxt_str_t *str, void *ctx) + { + njs_vm_t *vm; +- njs_int_t rc, ret; ++ njs_int_t ret; + njs_str_t res; +- njs_value_t *array, *value; ++ njs_value_t *value; + njs_function_t *func; +- njs_opaque_value_t opaque_value, arguments[6]; ++ njs_opaque_value_t retval, opaque_value, arguments[6]; + + static const njs_str_t uri_str = njs_str("uri"); + static const njs_str_t host_str = njs_str("host"); +@@ -407,15 +407,13 @@ nxt_js_call(nxt_task_t *task, nxt_js_conf_t *jcf, nxt_ + return NXT_ERROR; + } + +- ret = njs_vm_start(vm); ++ ret = njs_vm_start(vm, njs_value_arg(&retval)); + if (ret != NJS_OK) { + return NXT_ERROR; + } + +- array = njs_vm_retval(vm); +- + cache->vm = vm; +- cache->array = *array; ++ cache->array = *njs_value_arg(&retval); + } + + value = njs_vm_array_prop(vm, &cache->array, js->index, &opaque_value); +@@ -463,18 +461,20 @@ nxt_js_call(nxt_task_t *task, nxt_js_conf_t *jcf, nxt_ + return NXT_ERROR; + } + +- ret = njs_vm_call(vm, func, njs_value_arg(&arguments), 6); ++ ret = njs_vm_invoke(vm, func, njs_value_arg(&arguments), 6, ++ njs_value_arg(&retval)); + +- rc = njs_vm_retval_string(vm, &res); +- if (rc != NJS_OK) { +- return NXT_ERROR; +- } +- + if (ret != NJS_OK) { +- nxt_alert(task, "js exception: %V", &res); ++ ret = njs_vm_exception_string(vm, &res); ++ if (ret == NJS_OK) { ++ nxt_alert(task, "js exception: %V", &res); ++ } ++ + return NXT_ERROR; + } + ++ ret = njs_vm_value_string(vm, &res, njs_value_arg(&retval)); ++ + str->length = res.length; + str->start = res.start; + +@@ -498,7 +498,7 @@ nxt_js_error(njs_vm_t *vm, u_char *error) + njs_str_t res; + nxt_str_t err; + +- ret = njs_vm_retval_string(vm, &res); ++ ret = njs_vm_exception_string(vm, &res); + if (nxt_slow_path(ret != NJS_OK)) { + return NXT_ERROR; + }