Mercurial > hg > nginx
comparison src/http/ngx_http_file_cache.c @ 7267:7c614ef3c6ea
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.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Wed, 18 Apr 2018 16:11:41 +0300 |
parents | 72d3aefc2993 |
children | b5ea47df9bee |
comparison
equal
deleted
inserted
replaced
7266:1076268364ba | 7267:7c614ef3c6ea |
---|---|
2618 { | 2618 { |
2619 char *p = conf; | 2619 char *p = conf; |
2620 | 2620 |
2621 time_t valid; | 2621 time_t valid; |
2622 ngx_str_t *value; | 2622 ngx_str_t *value; |
2623 ngx_uint_t i, n, status; | 2623 ngx_int_t status; |
2624 ngx_uint_t i, n; | |
2624 ngx_array_t **a; | 2625 ngx_array_t **a; |
2625 ngx_http_cache_valid_t *v; | 2626 ngx_http_cache_valid_t *v; |
2626 static ngx_uint_t statuses[] = { 200, 301, 302 }; | 2627 static ngx_uint_t statuses[] = { 200, 301, 302 }; |
2627 | 2628 |
2628 a = (ngx_array_t **) (p + cmd->offset); | 2629 a = (ngx_array_t **) (p + cmd->offset); |