From: Dmitry Volyntsev Date: Tue, 7 Jun 2022 06:27:11 +0000 (-0700) Subject: HTTP: fixed r.headersOut special getters when value is absent. X-Git-Tag: 0.7.5~14 X-Git-Url: http://www.kaiwu.me/postgresql/commit/static/gitweb.js?a=commitdiff_plain;h=1186657c662a5d92d61a4c10486e98cdf5a0724e;p=njs.git 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. --- 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; }