Mercurial > hg > nginx
comparison src/http/modules/ngx_http_gzip_filter_module.c @ 3441:b0fbe6ab9ebe stable-0.7
merge r3309, r3314, r3315, r3380:
gzip headers related fixes:
*) remove "Content-Encoding: gzip" in 304 response
sent by ngx_http_gzip_static_module
*) refactor gzip_vary handling
*) test r->header_only last, since it's not actually
frequent here: 304 and HEAD responses are not set it before the filter
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Mon, 01 Feb 2010 15:54:02 +0000 |
parents | 2efa8d2fcde1 |
children |
comparison
equal
deleted
inserted
replaced
3440:88741ec7731a | 3441:b0fbe6ab9ebe |
---|---|
244 | 244 |
245 if (!conf->enable | 245 if (!conf->enable |
246 || (r->headers_out.status != NGX_HTTP_OK | 246 || (r->headers_out.status != NGX_HTTP_OK |
247 && r->headers_out.status != NGX_HTTP_FORBIDDEN | 247 && r->headers_out.status != NGX_HTTP_FORBIDDEN |
248 && r->headers_out.status != NGX_HTTP_NOT_FOUND) | 248 && r->headers_out.status != NGX_HTTP_NOT_FOUND) |
249 || r->header_only | |
250 || (r->headers_out.content_encoding | 249 || (r->headers_out.content_encoding |
251 && r->headers_out.content_encoding->value.len) | 250 && r->headers_out.content_encoding->value.len) |
252 || (r->headers_out.content_length_n != -1 | 251 || (r->headers_out.content_length_n != -1 |
253 && r->headers_out.content_length_n < conf->min_length) | 252 && r->headers_out.content_length_n < conf->min_length) |
254 || ngx_http_test_content_type(r, &conf->types) == NULL | 253 || ngx_http_test_content_type(r, &conf->types) == NULL |
255 || ngx_http_gzip_ok(r) != NGX_OK) | 254 || r->header_only) |
256 { | 255 { |
256 return ngx_http_next_header_filter(r); | |
257 } | |
258 | |
259 r->gzip_vary = 1; | |
260 | |
261 if (!r->gzip_tested) { | |
262 if (ngx_http_gzip_ok(r) != NGX_OK) { | |
263 return ngx_http_next_header_filter(r); | |
264 } | |
265 | |
266 } else if (!r->gzip_ok) { | |
257 return ngx_http_next_header_filter(r); | 267 return ngx_http_next_header_filter(r); |
258 } | 268 } |
259 | 269 |
260 ctx = ngx_pcalloc(r->pool, sizeof(ngx_http_gzip_ctx_t)); | 270 ctx = ngx_pcalloc(r->pool, sizeof(ngx_http_gzip_ctx_t)); |
261 if (ctx == NULL) { | 271 if (ctx == NULL) { |