]> git.kaiwu.me - njs.git/commitdiff
Fetch: fixed Headers() constructor.
authorDmitry Volyntsev <xeioex@nginx.com>
Fri, 10 Mar 2023 22:15:29 +0000 (14:15 -0800)
committerDmitry Volyntsev <xeioex@nginx.com>
Fri, 10 Mar 2023 22:15:29 +0000 (14:15 -0800)
Previously, the 'guard' field of ngx_js_headers_t structure was uninitialized,
that caused spurious exception "Error: cannot append to immutable object".

This issue was introduced on 0.7.10.

nginx/ngx_js_fetch.c

index 9824baf82ec76d71603d5d5ccc86ae4f24166bb7..f329d71722fd70f9e514cd333025aacd12193410 100644 (file)
@@ -860,6 +860,8 @@ ngx_js_ext_headers_constructor(njs_vm_t *vm, njs_value_t *args,
         return NJS_ERROR;
     }
 
+    headers->guard = GUARD_NONE;
+
     rc = ngx_list_init(&headers->header_list, pool, 4, sizeof(ngx_js_tb_elt_t));
     if (rc != NGX_OK) {
         njs_vm_memory_error(vm);