]> git.kaiwu.me - njs.git/commitdiff
Stream: throwing an exception when s.done() is used while filtering.
authorDmitry Volyntsev <xeioex@nginx.com>
Thu, 23 Jun 2022 06:37:15 +0000 (23:37 -0700)
committerDmitry Volyntsev <xeioex@nginx.com>
Thu, 23 Jun 2022 06:37:15 +0000 (23:37 -0700)
nginx/ngx_stream_js_module.c

index 8897b3aef9b2ca83e19e97b71b281e8a42c8683c..50c02acc8238db1a482cf51f7b2e5fc3d5d47328 100644 (file)
@@ -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);