]> git.kaiwu.me - nginx.git/commitdiff
do not add header if add_header ""
authorIgor Sysoev <igor@sysoev.ru>
Mon, 15 Dec 2008 10:50:57 +0000 (10:50 +0000)
committerIgor Sysoev <igor@sysoev.ru>
Mon, 15 Dec 2008 10:50:57 +0000 (10:50 +0000)
src/http/modules/ngx_http_headers_filter_module.c

index f4a6fe76fd2df38a8df283ba978acf30a8e3d3b2..764ddc94ce6f4cfae90ee6e3d257637775084650 100644 (file)
@@ -325,14 +325,16 @@ ngx_http_add_header(ngx_http_request_t *r, ngx_http_header_val_t *hv,
 {
     ngx_table_elt_t  *h;
 
-    h = ngx_list_push(&r->headers_out.headers);
-    if (h == NULL) {
-        return NGX_ERROR;
-    }
+    if (value->len) {
+        h = ngx_list_push(&r->headers_out.headers);
+        if (h == NULL) {
+            return NGX_ERROR;
+        }
 
-    h->hash = hv->value.hash;
-    h->key = hv->value.key;
-    h->value = *value;
+        h->hash = hv->value.hash;
+        h->key = hv->value.key;
+        h->value = *value;
+    }
 
     return NGX_OK;
 }