[nginx] Headers filter: empty Cache-Control is no longer added.

Maxim Dounin mdounin at mdounin.ru
Fri Oct 18 14:16:04 UTC 2013


details:   http://hg.nginx.org/nginx/rev/7ed23dcfea3d
branches:  
changeset: 5427:7ed23dcfea3d
user:      Maxim Dounin <mdounin at mdounin.ru>
date:      Fri Oct 18 18:13:44 2013 +0400
description:
Headers filter: empty Cache-Control is no longer added.

Much like with other headers, "add_header Cache-Control $value;" no longer
results in anything added to response headers if $value evaluates to an
empty string.

diffstat:

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

diffs (14 lines):

diff --git a/src/http/modules/ngx_http_headers_filter_module.c b/src/http/modules/ngx_http_headers_filter_module.c
--- a/src/http/modules/ngx_http_headers_filter_module.c
+++ b/src/http/modules/ngx_http_headers_filter_module.c
@@ -339,6 +339,10 @@ ngx_http_add_cache_control(ngx_http_requ
 {
     ngx_table_elt_t  *cc, **ccp;
 
+    if (value->len == 0) {
+        return NGX_OK;
+    }
+
     ccp = r->headers_out.cache_control.elts;
 
     if (ccp == NULL) {



More information about the nginx-devel mailing list