comparison src/http/modules/ngx_http_gzip_filter_module.c @ 578:f3a9e57d2e17

Merge with current.
author Maxim Dounin <mdounin@mdounin.ru>
date Thu, 11 Mar 2010 21:27:17 +0300
parents 25255878df91
children 8246d8a2c2be
comparison
equal deleted inserted replaced
539:5f4de8cf0d9d 578:f3a9e57d2e17
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) {
1111 ngx_conf_merge_size_value(conf->wbits, prev->wbits, MAX_WBITS); 1121 ngx_conf_merge_size_value(conf->wbits, prev->wbits, MAX_WBITS);
1112 ngx_conf_merge_size_value(conf->memlevel, prev->memlevel, 1122 ngx_conf_merge_size_value(conf->memlevel, prev->memlevel,
1113 MAX_MEM_LEVEL - 1); 1123 MAX_MEM_LEVEL - 1);
1114 ngx_conf_merge_value(conf->min_length, prev->min_length, 20); 1124 ngx_conf_merge_value(conf->min_length, prev->min_length, 20);
1115 1125
1116 if (ngx_http_merge_types(cf, conf->types_keys, &conf->types, 1126 if (ngx_http_merge_types(cf, &conf->types_keys, &conf->types,
1117 prev->types_keys, &prev->types, 1127 &prev->types_keys, &prev->types,
1118 ngx_http_html_default_types) 1128 ngx_http_html_default_types)
1119 != NGX_OK) 1129 != NGX_OK)
1120 { 1130 {
1121 return NGX_CONF_ERROR; 1131 return NGX_CONF_ERROR;
1122 } 1132 }