]> git.kaiwu.me - njs.git/commitdiff
QuickJS: fix promise and event leak on proxy URL evaluation failure
authorDmitry Volyntsev <xeioex@nginx.com>
Thu, 11 Jun 2026 23:46:43 +0000 (16:46 -0700)
committerDmitry Volyntsev <xeioexception@gmail.com>
Fri, 12 Jun 2026 03:26:59 +0000 (20:26 -0700)
Previously, when dynamic proxy URL evaluation failed in
ngx_qjs_fetch(), the error was returned directly, bypassing the fail
path which deletes the registered fetch event and releases the
promise.  The njs counterpart already goes through the fail path.

As a side effect, the error is now reported by rejecting the
returned promise instead of throwing synchronously, consistently
with the other failure paths.

nginx/ngx_qjs_fetch.c

index 1754f4ebc2898675d9d2e0894992b7e29998a506..854deb521c32d3bfa1a349050d1565d333c06644 100644 (file)
@@ -346,7 +346,7 @@ ngx_qjs_ext_fetch(JSContext *cx, JSValueConst this_val, int argc,
                 != NGX_OK)
             {
                 JS_ThrowInternalError(cx, "failed to evaluate proxy URL");
-                return JS_EXCEPTION;
+                goto fail;
             }
 
         } else {