]> git.kaiwu.me - nginx.git/commitdiff
nginx sent gzipped responses to clients those do not support gzip,
authorIgor Sysoev <igor@sysoev.ru>
Wed, 11 Nov 2009 21:12:41 +0000 (21:12 +0000)
committerIgor Sysoev <igor@sysoev.ru>
Wed, 11 Nov 2009 21:12:41 +0000 (21:12 +0000)
if "gzip_static on" and "gzip_vary off"; the bug had been introduced in r3136

src/http/modules/ngx_http_gzip_static_module.c

index 25ab64ca4bc7d403a1c9bbc68013b3ca229083c3..cff23e02a55a682e6a3f0bf0d536fe429244f63e 100644 (file)
@@ -99,9 +99,11 @@ ngx_http_gzip_static_handler(ngx_http_request_t *r)
         return NGX_DECLINED;
     }
 
+    rc = ngx_http_gzip_ok(r);
+
     clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
 
-    if (clcf->gzip_vary && ngx_http_gzip_ok(r) != NGX_OK) {
+    if (!clcf->gzip_vary && rc != NGX_OK) {
         return NGX_DECLINED;
     }
 
@@ -163,6 +165,10 @@ ngx_http_gzip_static_handler(ngx_http_request_t *r)
         return NGX_DECLINED;
     }
 
+    if (rc != NGX_OK) {
+        return NGX_DECLINED;
+    }
+
     ngx_log_debug1(NGX_LOG_DEBUG_HTTP, log, 0, "http static fd: %d", of.fd);
 
     if (of.is_dir) {