Welcome! Log In Create A New Profile

Advanced

[nginx] Cache: improved keys zone size error reporting.

Maxim Dounin
October 31, 2018 10:44AM
details: http://hg.nginx.org/nginx/rev/bddacdaaec9e
branches:
changeset: 7375:bddacdaaec9e
user: Maxim Dounin <mdounin@mdounin.ru>
date: Wed Oct 31 16:49:40 2018 +0300
description:
Cache: improved keys zone size error reporting.

After this change, too small keys zones are explicitly reported as such,
much like in the other modules which use shared memory.

diffstat:

src/http/ngx_http_file_cache.c | 39 ++++++++++++++++++++++++---------------
1 files changed, 24 insertions(+), 15 deletions(-)

diffs (51 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
@@ -2418,23 +2418,32 @@ ngx_http_file_cache_set_slot(ngx_conf_t

p = (u_char *) ngx_strchr(name.data, ':');

- if (p) {
- name.len = p - name.data;
-
- p++;
-
- s.len = value[i].data + value[i].len - p;
- s.data = p;
-
- size = ngx_parse_size(&s);
- if (size >= (ssize_t) (2 * ngx_pagesize)) {
- continue;
- }
+ if (p == NULL) {
+ ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
+ "invalid keys zone size \"%V\"", &value[i]);
+ return NGX_CONF_ERROR;
}

- ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
- "invalid keys zone size \"%V\"", &value[i]);
- return NGX_CONF_ERROR;
+ name.len = p - name.data;
+
+ s.data = p + 1;
+ s.len = value[i].data + value[i].len - s.data;
+
+ size = ngx_parse_size(&s);
+
+ if (size == NGX_ERROR) {
+ ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
+ "invalid keys zone size \"%V\"", &value[i]);
+ return NGX_CONF_ERROR;
+ }
+
+ if (size < (ssize_t) (2 * ngx_pagesize)) {
+ ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
+ "keys zone \"%V\" is too small", &value[i]);
+ return NGX_CONF_ERROR;
+ }
+
+ continue;
}

if (ngx_strncmp(value[i].data, "inactive=", 9) == 0) {
_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[nginx] Cache: improved keys zone size error reporting.

Maxim Dounin 331 October 31, 2018 10:44AM



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

Online Users

Guests: 300
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