]> git.kaiwu.me - nginx.git/commitdiff
nginx always sent "Vary: Accept-Encoding",
authorIgor Sysoev <igor@sysoev.ru>
Tue, 15 Sep 2009 11:57:29 +0000 (11:57 +0000)
committerIgor Sysoev <igor@sysoev.ru>
Tue, 15 Sep 2009 11:57:29 +0000 (11:57 +0000)
if both gzip_static and gzip_vary were on

src/http/modules/ngx_http_gzip_static_module.c

index 19e4128417177d6f8718de25f39048ff278863d2..8080d9cb08248973a9b2f727f379b9b218a290c5 100644 (file)
@@ -95,7 +95,13 @@ ngx_http_gzip_static_handler(ngx_http_request_t *r)
 
     gzcf = ngx_http_get_module_loc_conf(r, ngx_http_gzip_static_module);
 
-    if (!gzcf->enable || ngx_http_gzip_ok(r) != NGX_OK) {
+    if (!gzcf->enable) {
+        return NGX_DECLINED;
+    }
+
+    clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
+
+    if (clcf->gzip_vary && ngx_http_gzip_ok(r) != NGX_OK) {
         return NGX_DECLINED;
     }
 
@@ -116,8 +122,6 @@ ngx_http_gzip_static_handler(ngx_http_request_t *r)
     ngx_log_debug1(NGX_LOG_DEBUG_HTTP, log, 0,
                    "http filename: \"%s\"", path.data);
 
-    clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
-
     ngx_memzero(&of, sizeof(ngx_open_file_info_t));
 
     of.directio = clcf->directio;
@@ -138,6 +142,7 @@ ngx_http_gzip_static_handler(ngx_http_request_t *r)
         case NGX_ENOTDIR:
         case NGX_ENAMETOOLONG:
 
+            r->gzip = 0;
             return NGX_DECLINED;
 
         case NGX_EACCES: