comparison src/http/ngx_http_file_cache.c @ 7375:bddacdaaec9e

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.
author Maxim Dounin <mdounin@mdounin.ru>
date Wed, 31 Oct 2018 16:49:40 +0300
parents de50fa05fbeb
children ccb5ff87ab3e
comparison
equal deleted inserted replaced
7374:de50fa05fbeb 7375:bddacdaaec9e
2416 2416
2417 name.data = value[i].data + 10; 2417 name.data = value[i].data + 10;
2418 2418
2419 p = (u_char *) ngx_strchr(name.data, ':'); 2419 p = (u_char *) ngx_strchr(name.data, ':');
2420 2420
2421 if (p) { 2421 if (p == NULL) {
2422 name.len = p - name.data; 2422 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
2423 2423 "invalid keys zone size \"%V\"", &value[i]);
2424 p++; 2424 return NGX_CONF_ERROR;
2425
2426 s.len = value[i].data + value[i].len - p;
2427 s.data = p;
2428
2429 size = ngx_parse_size(&s);
2430 if (size >= (ssize_t) (2 * ngx_pagesize)) {
2431 continue;
2432 }
2433 } 2425 }
2434 2426
2435 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, 2427 name.len = p - name.data;
2436 "invalid keys zone size \"%V\"", &value[i]); 2428
2437 return NGX_CONF_ERROR; 2429 s.data = p + 1;
2430 s.len = value[i].data + value[i].len - s.data;
2431
2432 size = ngx_parse_size(&s);
2433
2434 if (size == NGX_ERROR) {
2435 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
2436 "invalid keys zone size \"%V\"", &value[i]);
2437 return NGX_CONF_ERROR;
2438 }
2439
2440 if (size < (ssize_t) (2 * ngx_pagesize)) {
2441 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
2442 "keys zone \"%V\" is too small", &value[i]);
2443 return NGX_CONF_ERROR;
2444 }
2445
2446 continue;
2438 } 2447 }
2439 2448
2440 if (ngx_strncmp(value[i].data, "inactive=", 9) == 0) { 2449 if (ngx_strncmp(value[i].data, "inactive=", 9) == 0) {
2441 2450
2442 s.len = value[i].len - 9; 2451 s.len = value[i].len - 9;