Welcome! Log In Create A New Profile

Advanced

[nginx] Cache: fixed cache valid slot to reject incorrect statuses.

Maxim Dounin
April 18, 2018 09:26AM
details: http://hg.nginx.org/nginx/rev/7c614ef3c6ea
branches:
changeset: 7267:7c614ef3c6ea
user: Maxim Dounin <mdounin@mdounin.ru>
date: Wed Apr 18 16:11:41 2018 +0300
description:
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:

src/http/ngx_http_file_cache.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)

diffs (13 lines):

diff --git a/src/http/ngx_http_file_cache.c b/src/http/ngx_http_file_cache.c
--- 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_c

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 };
_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[nginx] Cache: fixed cache valid slot to reject incorrect statuses.

Maxim Dounin 291 April 18, 2018 09:26AM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 310
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready