[njs] Stream: throwing an exception when s.done() is used while filtering.

Dmitry Volyntsev xeioex at nginx.com
Thu Jun 23 06:40:52 UTC 2022


details:   https://hg.nginx.org/njs/rev/9f544b8e28c5
branches:  
changeset: 1896:9f544b8e28c5
user:      Dmitry Volyntsev <xeioex at nginx.com>
date:      Wed Jun 22 23:37:15 2022 -0700
description:
Stream: throwing an exception when s.done() is used while filtering.

diffstat:

 nginx/ngx_stream_js_module.c |  5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diffs (15 lines):

diff -r f7fec5be38a0 -r 9f544b8e28c5 nginx/ngx_stream_js_module.c
--- a/nginx/ngx_stream_js_module.c	Tue Jun 21 21:54:14 2022 -0700
+++ b/nginx/ngx_stream_js_module.c	Wed Jun 22 23:37:15 2022 -0700
@@ -1114,6 +1114,11 @@ ngx_stream_js_ext_done(njs_vm_t *vm, njs
 
     ctx = ngx_stream_get_module_ctx(s, ngx_stream_js_module);
 
+    if (ctx->filter) {
+        njs_vm_error(vm, "should not be called while filtering");
+        return NJS_ERROR;
+    }
+
     ngx_log_debug1(NGX_LOG_DEBUG_STREAM, s->connection->log, 0,
                    "stream js set status: %i", status);
 



More information about the nginx-devel mailing list