From 8dfc60b505da81d1430a79b86044f6e89a2d95e8 Mon Sep 17 00:00:00 2001 From: Dmitry Volyntsev Date: Wed, 22 Jun 2022 23:37:15 -0700 Subject: [PATCH] Stream: throwing an exception when s.done() is used while filtering. --- nginx/ngx_stream_js_module.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/nginx/ngx_stream_js_module.c b/nginx/ngx_stream_js_module.c index 8897b3ae..50c02acc 100644 --- a/nginx/ngx_stream_js_module.c +++ b/nginx/ngx_stream_js_module.c @@ -1114,6 +1114,11 @@ ngx_stream_js_ext_done(njs_vm_t *vm, njs_value_t *args, njs_uint_t nargs, 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); -- 2.47.3