]> git.kaiwu.me - njs.git/commitdiff
HTTP: fixed r.headersOut special getters when value is absent.
authorDmitry Volyntsev <xeioex@nginx.com>
Tue, 7 Jun 2022 06:27:11 +0000 (23:27 -0700)
committerDmitry Volyntsev <xeioex@nginx.com>
Tue, 7 Jun 2022 06:27:11 +0000 (23:27 -0700)
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

index 206d5a73f501364c7f565277f1f4be5ca6ee3f48..cc3ece3db8fcf6a4b67c4b2a072531ec1e292c26 100644 (file)
@@ -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;
     }