[nginx] Headers filter: fixed "add_header ... '' always".

Ruslan Ermilov ru at nginx.com
Fri Feb 19 13:29:37 UTC 2016


details:   http://hg.nginx.org/nginx/rev/5dfc63c1d9ca
branches:  
changeset: 6405:5dfc63c1d9ca
user:      Ruslan Ermilov <ru at nginx.com>
date:      Thu Feb 18 15:49:11 2016 +0300
description:
Headers filter: fixed "add_header ... '' always".

The "always" parameter was ignored if the header value was empty.

diffstat:

 src/http/modules/ngx_http_headers_filter_module.c |  16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)

diffs (29 lines):

diff -r 09d5a22c76bd -r 5dfc63c1d9ca src/http/modules/ngx_http_headers_filter_module.c
--- a/src/http/modules/ngx_http_headers_filter_module.c	Fri Feb 19 13:31:55 2016 +0300
+++ b/src/http/modules/ngx_http_headers_filter_module.c	Thu Feb 18 15:49:11 2016 +0300
@@ -712,17 +712,17 @@ ngx_http_headers_add(ngx_conf_t *cf, ngx
 
     if (value[2].len == 0) {
         ngx_memzero(&hv->value, sizeof(ngx_http_complex_value_t));
-        return NGX_CONF_OK;
-    }
 
-    ngx_memzero(&ccv, sizeof(ngx_http_compile_complex_value_t));
+    } else {
+        ngx_memzero(&ccv, sizeof(ngx_http_compile_complex_value_t));
 
-    ccv.cf = cf;
-    ccv.value = &value[2];
-    ccv.complex_value = &hv->value;
+        ccv.cf = cf;
+        ccv.value = &value[2];
+        ccv.complex_value = &hv->value;
 
-    if (ngx_http_compile_complex_value(&ccv) != NGX_OK) {
-        return NGX_CONF_ERROR;
+        if (ngx_http_compile_complex_value(&ccv) != NGX_OK) {
+            return NGX_CONF_ERROR;
+        }
     }
 
     if (cf->args->nelts == 3) {



More information about the nginx-devel mailing list