[njs] HTTP: added support for delete operation in r.headersOut.

Dmitry Volyntsev xeioex at nginx.com
Thu Feb 7 17:40:41 UTC 2019


details:   https://hg.nginx.org/njs/rev/0913527ad077
branches:  
changeset: 767:0913527ad077
user:      Dmitry Volyntsev <xeioex at nginx.com>
date:      Thu Feb 07 20:05:14 2019 +0300
description:
HTTP: added support for delete operation in r.headersOut.

This closes #64 issue on Github.

diffstat:

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

diffs (40 lines):

diff -r 016d5d9077ef -r 0913527ad077 nginx/ngx_http_js_module.c
--- a/nginx/ngx_http_js_module.c	Wed Feb 06 19:52:54 2019 +0300
+++ b/nginx/ngx_http_js_module.c	Thu Feb 07 20:05:14 2019 +0300
@@ -71,6 +71,8 @@ static njs_ret_t ngx_http_js_ext_get_hea
     njs_value_t *value, void *obj, uintptr_t data);
 static njs_ret_t ngx_http_js_ext_set_header_out(njs_vm_t *vm, void *obj,
     uintptr_t data, nxt_str_t *value);
+static njs_ret_t ngx_http_js_ext_delete_header_out(njs_vm_t *vm, void *obj,
+    uintptr_t data, nxt_bool_t delete);
 static njs_ret_t ngx_http_js_ext_foreach_header_out(njs_vm_t *vm, void *obj,
     void *next); /*FIXME*/
 static njs_ret_t ngx_http_js_ext_get_status(njs_vm_t *vm, njs_value_t *value,
@@ -344,7 +346,7 @@ static njs_external_t  ngx_http_js_ext_r
       0,
       ngx_http_js_ext_get_header_out,
       ngx_http_js_ext_set_header_out,
-      NULL,
+      ngx_http_js_ext_delete_header_out,
       ngx_http_js_ext_foreach_header_out,
       ngx_http_js_ext_next_header,
       NULL,
@@ -1016,6 +1018,18 @@ ngx_http_js_ext_set_header_out(njs_vm_t 
 
 
 static njs_ret_t
+ngx_http_js_ext_delete_header_out(njs_vm_t *vm, void *obj, uintptr_t data,
+    nxt_bool_t unused)
+{
+    nxt_str_t  value;
+
+    value = nxt_string_value("");
+
+    return ngx_http_js_ext_set_header_out(vm, obj, data, &value);
+}
+
+
+static njs_ret_t
 ngx_http_js_ext_foreach_header_out(njs_vm_t *vm, void *obj, void *next)
 {
     return ngx_http_js_ext_foreach_header(vm, obj, next,


More information about the nginx-devel mailing list