]> git.kaiwu.me - nginx.git/commitdiff
Headers filter: fixed "add_header ... '' always".
authorRuslan Ermilov <ru@nginx.com>
Thu, 18 Feb 2016 12:49:11 +0000 (15:49 +0300)
committerRuslan Ermilov <ru@nginx.com>
Thu, 18 Feb 2016 12:49:11 +0000 (15:49 +0300)
The "always" parameter was ignored if the header value was empty.

src/http/modules/ngx_http_headers_filter_module.c

index 985e5b33508f399a5fae17e4f806efc4f4de95e8..6738afe9fbd0fdb22b3d41caff8940fbcf55416e 100644 (file)
@@ -712,17 +712,17 @@ ngx_http_headers_add(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
 
     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) {