]> git.kaiwu.me - njs.git/commit
Modules: fixed Fetch Response prototype reinitialization.
authorDmitry Volyntsev <xeioex@nginx.com>
Wed, 16 Nov 2022 02:38:49 +0000 (18:38 -0800)
committerDmitry Volyntsev <xeioex@nginx.com>
Wed, 16 Nov 2022 02:38:49 +0000 (18:38 -0800)
commitd4b87eeb486818b9a00733ffcf3ec80f91d97bab
tree83d902e477895f477acc30296454af12fed50f22
parent171af3961ff3f50105595d0764a1ad24e07cfa1f
Modules: fixed Fetch Response prototype reinitialization.

Previously, since 446a1cb64a6a (0.7.7), when at least one js_import directive
was declared in both HTTP and Stream, ngx.fetch() returned inapproriate
response in Stream.

The prototype for Response object was created two times for HTTP and STREAM,
but the second initialization of global variable with the index of the
Response() prototype overwrites the first value with a different value.  This
caused a problem in Stream code which manifested itself as a `Stream flags`
object returned as a result of ngx.fetch() call instead of a Response instance.

The fix is to ensure that shared prototypes like a Response prototype
have indentical index value in all the modules.

This fixes #596 issue on Github.
nginx/ngx_js.c