diff options
author | Igor Sysoev <igor@sysoev.ru> | 2009-04-06 08:35:34 +0000 |
---|---|---|
committer | Igor Sysoev <igor@sysoev.ru> | 2009-04-06 08:35:34 +0000 |
commit | 43f3f4a73dc35cf1242ab86a6ec3b7c3242f4aa3 (patch) | |
tree | fa9a38744bcb265cd35241a75c077ec5fc1c5ad1 /src | |
parent | 1dcaa97ccc0461df87a7c2956ce9f6b4fb1d0467 (diff) | |
download | nginx-43f3f4a73dc35cf1242ab86a6ec3b7c3242f4aa3.tar.gz nginx-43f3f4a73dc35cf1242ab86a6ec3b7c3242f4aa3.zip |
fix cache path slot
Diffstat (limited to 'src')
-rw-r--r-- | src/http/ngx_http_file_cache.c | 20 |
1 files changed, 5 insertions, 15 deletions
diff --git a/src/http/ngx_http_file_cache.c b/src/http/ngx_http_file_cache.c index d000a9d14..005c59779 100644 --- 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 *cf, ngx_command_t *cmd, void *conf) 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 *cf, ngx_command_t *cmd, void *conf) 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; |