diff src/http/ngx_http_header_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 507fc5ac9839
children 616da2ea901f 667c22171519
line wrap: on
line diff
--- a/src/http/ngx_http_header_filter_module.c
+++ b/src/http/ngx_http_header_filter_module.c
@@ -399,8 +399,13 @@ ngx_http_header_filter(ngx_http_request_
     }
 
 #if (NGX_HTTP_GZIP)
-    if (r->gzip && clcf->gzip_vary) {
-        len += sizeof("Vary: Accept-Encoding" CRLF) - 1;
+    if (r->gzip_vary) {
+        if (clcf->gzip_vary) {
+            len += sizeof("Vary: Accept-Encoding" CRLF) - 1;
+
+        } else {
+            r->gzip_vary = 0;
+        }
     }
 #endif
 
@@ -559,7 +564,7 @@ ngx_http_header_filter(ngx_http_request_
     }
 
 #if (NGX_HTTP_GZIP)
-    if (r->gzip && clcf->gzip_vary) {
+    if (r->gzip_vary) {
         b->last = ngx_cpymem(b->last, "Vary: Accept-Encoding" CRLF,
                              sizeof("Vary: Accept-Encoding" CRLF) - 1);
     }