diff src/http/modules/ngx_http_gzip_filter.c @ 164:84036764e215

nginx-0.0.1-2003-10-29-11:30:44 import
author Igor Sysoev <igor@sysoev.ru>
date Wed, 29 Oct 2003 08:30:44 +0000
parents e7e094d34162
children 894a01c6aea3
line wrap: on
line diff
--- a/src/http/modules/ngx_http_gzip_filter.c
+++ b/src/http/modules/ngx_http_gzip_filter.c
@@ -190,18 +190,23 @@ static int ngx_http_gzip_header_filter(n
                         sizeof(ngx_http_gzip_ctx_t), NGX_ERROR);
     ctx->request = r;
 
-    ngx_test_null(r->headers_out.content_encoding,
-                  ngx_push_table(r->headers_out.headers),
-                  NGX_ERROR);
+    if (!(r->headers_out.content_encoding =
+                   ngx_http_add_header(&r->headers_out, ngx_http_headers_out)))
+    {
+        return NGX_ERROR;
+    }
 
     r->headers_out.content_encoding->key.len = 0;
     r->headers_out.content_encoding->key.data = NULL;
-    r->headers_out.content_encoding->value.len = 4;
+    r->headers_out.content_encoding->value.len = sizeof("gzip") - 1;
     r->headers_out.content_encoding->value.data = "gzip";
 
     ctx->length = r->headers_out.content_length_n;
     r->headers_out.content_length_n = -1;
-    r->headers_out.content_length = NULL;
+    if (r->headers_out.content_length) {
+        r->headers_out.content_length->key.len = 0;
+        r->headers_out.content_length = NULL;
+    }
     r->filter |= NGX_HTTP_FILTER_NEED_IN_MEMORY;
 
     return ngx_http_next_header_filter(r);