diff src/http/ngx_http_file_cache.c @ 472:09f0ef15d544 NGINX_0_7_48

nginx 0.7.48 *) Feature: the "proxy_cache_key" directive. *) Bugfix: now nginx takes into account the "X-Accel-Expires", "Expires", and "Cache-Control" header lines in a backend response. *) Bugfix: now nginx caches responses for the GET requests only. *) Bugfix: the "fastcgi_cache_key" directive was not inherited. *) Bugfix: the $arg_... variables did not work with SSI subrequests. Thanks to Maxim Dounin. *) Bugfix: nginx could not be built with uclibc library. Thanks to Timothy Redaelli. *) Bugfix: nginx could not be built on OpenBSD; the bug had appeared in 0.7.46.
author Igor Sysoev <http://sysoev.ru>
date Mon, 06 Apr 2009 00:00:00 +0400
parents 6866b490272e
children f2c6a7373274
line wrap: on
line diff
--- a/src/http/ngx_http_file_cache.c
+++ b/src/http/ngx_http_file_cache.c
@@ -1357,13 +1357,12 @@ ngx_http_file_cache_set_slot(ngx_conf_t 
 
         if (ngx_strncmp(value[i].data, "levels=", 7) == 0) {
 
-            n = 0;
             p = value[i].data + 7;
             last = value[i].data + value[i].len;
 
-            while (p < last) {
+            for (n = 0; n < 3 && p < last; n++) {
 
-                if (*p > '0' && *p < '6') {
+                if (*p > '0' && *p < '3') {
 
                     cache->path->level[n] = *p++ - '0';
                     cache->path->len += cache->path->level[n] + 1;
@@ -1372,20 +1371,11 @@ ngx_http_file_cache_set_slot(ngx_conf_t 
                         break;
                     }
 
-                    if (*p++ == ':') {
-
-                        if (n > 2) {
-                            goto invalid_levels;
-                        }
-
-                        if (cache->path->level[n] == 0) {
-                            goto invalid_levels;
-                        }
-
-                        n++;
-
+                    if (*p++ == ':' && n < 2 && p != last) {
                         continue;
                     }
+
+                    goto invalid_levels;
                 }
 
                 goto invalid_levels;