From 1186657c662a5d92d61a4c10486e98cdf5a0724e Mon Sep 17 00:00:00 2001 From: Dmitry Volyntsev Date: Mon, 6 Jun 2022 23:27:11 -0700 Subject: [PATCH] HTTP: fixed r.headersOut special getters when value is absent. Previously, when Content-Encoding or Content-Length header was absent, an exception was thrown erroneously. This closes #537 issue on Github. --- nginx/ngx_http_js_module.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/nginx/ngx_http_js_module.c b/nginx/ngx_http_js_module.c index 206d5a73..cc3ece3d 100644 --- a/nginx/ngx_http_js_module.c +++ b/nginx/ngx_http_js_module.c @@ -1900,7 +1900,7 @@ ngx_http_js_content_encoding(njs_vm_t *vm, ngx_http_request_t *r, ngx_table_elt_t *h; rc = ngx_http_js_header_out_special(vm, r, v, setval, retval, &h); - if (rc != NJS_OK) { + if (rc == NJS_ERROR) { return NJS_ERROR; } @@ -1940,7 +1940,7 @@ ngx_http_js_content_length(njs_vm_t *vm, ngx_http_request_t *r, } rc = ngx_http_js_header_out_special(vm, r, v, setval, retval, &h); - if (rc != NJS_OK) { + if (rc == NJS_ERROR) { return NJS_ERROR; } @@ -3686,7 +3686,7 @@ ngx_http_js_content_encoding(njs_vm_t *vm, ngx_http_request_t *r, ngx_table_elt_t *h; rc = ngx_http_js_header_out_special(vm, r, v, setval, retval, &h); - if (rc != NJS_OK) { + if (rc == NJS_ERROR) { return NJS_ERROR; } @@ -3726,7 +3726,7 @@ ngx_http_js_content_length(njs_vm_t *vm, ngx_http_request_t *r, } rc = ngx_http_js_header_out_special(vm, r, v, setval, retval, &h); - if (rc != NJS_OK) { + if (rc == NJS_ERROR) { return NJS_ERROR; } -- 2.47.3