changeset 2406:008777fa59e0

do not add header if add_header ""
author Igor Sysoev <igor@sysoev.ru>
date Mon, 15 Dec 2008 10:50:57 +0000
parents 5c0c7f65f8f0
children 16d1236bc298
files src/http/modules/ngx_http_headers_filter_module.c
diffstat 1 files changed, 9 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/src/http/modules/ngx_http_headers_filter_module.c
+++ b/src/http/modules/ngx_http_headers_filter_module.c
@@ -325,15 +325,17 @@ ngx_http_add_header(ngx_http_request_t *
 {
     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;
 }