diff options
author | Maxim Dounin <mdounin@mdounin.ru> | 2018-04-18 16:11:41 +0300 |
---|---|---|
committer | Maxim Dounin <mdounin@mdounin.ru> | 2018-04-18 16:11:41 +0300 |
commit | 8b4c7725d2015637584c4fa66667ad1ced21edb8 (patch) | |
tree | faa521141d057b9bc9b9ee020b68c03d5c0f8016 /src | |
parent | 59d806b56f4898ff9f36027611cbd466ff977958 (diff) | |
download | nginx-8b4c7725d2015637584c4fa66667ad1ced21edb8.tar.gz nginx-8b4c7725d2015637584c4fa66667ad1ced21edb8.zip |
Cache: fixed cache valid slot to reject incorrect statuses.
Previously, result of ngx_atoi() was assigned to an ngx_uint_t variable,
and errors reported by ngx_atoi() became positive, so the following check
in "status < 100" failed to catch them. This resulted in the configurations
like "proxy_cache_valid 2xx 30s" being accepted as correct, while they
in fact do nothing. Changing type to ngx_int_t fixes this, and such
configurations are now properly rejected.
Diffstat (limited to 'src')
-rw-r--r-- | src/http/ngx_http_file_cache.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/http/ngx_http_file_cache.c b/src/http/ngx_http_file_cache.c index 3b2b68a26..56866fa4e 100644 --- a/src/http/ngx_http_file_cache.c +++ b/src/http/ngx_http_file_cache.c @@ -2620,7 +2620,8 @@ ngx_http_file_cache_valid_set_slot(ngx_conf_t *cf, ngx_command_t *cmd, time_t valid; ngx_str_t *value; - ngx_uint_t i, n, status; + ngx_int_t status; + ngx_uint_t i, n; ngx_array_t **a; ngx_http_cache_valid_t *v; static ngx_uint_t statuses[] = { 200, 301, 302 }; |