[njs] HTTP: adding a warning for ignored outgoing header assignments.

Dmitry Volyntsev xeioex at nginx.com
Fri Sep 23 02:18:08 UTC 2022


details:   https://hg.nginx.org/njs/rev/ef0e05668f39
branches:  
changeset: 1961:ef0e05668f39
user:      Dmitry Volyntsev <xeioex at nginx.com>
date:      Thu Sep 22 19:05:36 2022 -0700
description:
HTTP: adding a warning for ignored outgoing header assignments.

diffstat:

 nginx/ngx_http_js_module.c |  5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diffs (15 lines):

diff -r 74d30c2d70f3 -r ef0e05668f39 nginx/ngx_http_js_module.c
--- a/nginx/ngx_http_js_module.c	Tue Sep 20 17:44:25 2022 -0700
+++ b/nginx/ngx_http_js_module.c	Thu Sep 22 19:05:36 2022 -0700
@@ -1565,6 +1565,11 @@ ngx_http_js_ext_header_out(njs_vm_t *vm,
         return NJS_DECLINED;
     }
 
+    if (r->header_sent && setval != NULL) {
+        njs_vm_warn(vm, "ignored setting of response header \"%V\" because"
+                        " headers were already sent", &name);
+    }
+
     for (h = headers_out; h->name.length > 0; h++) {
         if (h->name.length == name.length
             && ngx_strncasecmp(h->name.start, name.start, name.length) == 0)



More information about the nginx-devel mailing list