]> git.kaiwu.me - njs.git/commit
QuickJS: keep reused contexts in their origin queue
authorDmitry Volyntsev <xeioex@nginx.com>
Fri, 14 Aug 2026 03:41:33 +0000 (20:41 -0700)
committerDmitry Volyntsev <xeioexception@gmail.com>
Fri, 14 Aug 2026 23:05:54 +0000 (16:05 -0700)
commite2087450109fe336ecca25ed350f120586a6c46f
tree21b228198e280baff69435b213b648521927573f
parent5f5384d8bdd5003739d0ad7a31c78f8c3314ed42
QuickJS: keep reused contexts in their origin queue

After an internal redirect, HTTP cleanup selected the destination
location configuration.  If the source and destination used different
module graphs, the source context was inserted into the destination
reuse queue.  A later request could then run a destination handler in
the source runtime, returning an incorrect response or a 500 error.

Record the originating location configuration in each cloned JavaScript
context and use it during teardown.  Source and destination reuse queues
now remain isolated even though internal redirects mutate the request's
current location.
nginx/ngx_http_js_module.c
nginx/ngx_js.c
nginx/ngx_js.h
nginx/ngx_stream_js_module.c
nginx/t/js_context_reuse_redirect.t [new file with mode: 0644]