comparison 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
comparison
equal deleted inserted replaced
163:fb61ba77beba 164:84036764e215
188 188
189 ngx_http_create_ctx(r, ctx, ngx_http_gzip_filter_module, 189 ngx_http_create_ctx(r, ctx, ngx_http_gzip_filter_module,
190 sizeof(ngx_http_gzip_ctx_t), NGX_ERROR); 190 sizeof(ngx_http_gzip_ctx_t), NGX_ERROR);
191 ctx->request = r; 191 ctx->request = r;
192 192
193 ngx_test_null(r->headers_out.content_encoding, 193 if (!(r->headers_out.content_encoding =
194 ngx_push_table(r->headers_out.headers), 194 ngx_http_add_header(&r->headers_out, ngx_http_headers_out)))
195 NGX_ERROR); 195 {
196 return NGX_ERROR;
197 }
196 198
197 r->headers_out.content_encoding->key.len = 0; 199 r->headers_out.content_encoding->key.len = 0;
198 r->headers_out.content_encoding->key.data = NULL; 200 r->headers_out.content_encoding->key.data = NULL;
199 r->headers_out.content_encoding->value.len = 4; 201 r->headers_out.content_encoding->value.len = sizeof("gzip") - 1;
200 r->headers_out.content_encoding->value.data = "gzip"; 202 r->headers_out.content_encoding->value.data = "gzip";
201 203
202 ctx->length = r->headers_out.content_length_n; 204 ctx->length = r->headers_out.content_length_n;
203 r->headers_out.content_length_n = -1; 205 r->headers_out.content_length_n = -1;
204 r->headers_out.content_length = NULL; 206 if (r->headers_out.content_length) {
207 r->headers_out.content_length->key.len = 0;
208 r->headers_out.content_length = NULL;
209 }
205 r->filter |= NGX_HTTP_FILTER_NEED_IN_MEMORY; 210 r->filter |= NGX_HTTP_FILTER_NEED_IN_MEMORY;
206 211
207 return ngx_http_next_header_filter(r); 212 return ngx_http_next_header_filter(r);
208 } 213 }
209 214