3 * Copyright (C) Igor Sysoev
7 #include <ngx_config.h>
10 #define NGX_CONF_BUFFER 4096
12 static ngx_int_t ngx_conf_handler(ngx_conf_t *cf, ngx_int_t last);
13 static ngx_int_t ngx_conf_read_token(ngx_conf_t *cf);
14 static char *ngx_conf_include(ngx_conf_t *cf, ngx_command_t *cmd, void *conf);
15 static void ngx_conf_flush_files(ngx_cycle_t *cycle);
18 static ngx_command_t ngx_conf_commands[] = {
20 { ngx_string("include"),
21 NGX_ANY_CONF|NGX_CONF_TAKE1,
31 ngx_module_t ngx_conf_module = {
33 NULL, /* module context */
34 ngx_conf_commands, /* module directives */
35 NGX_CONF_MODULE, /* module type */
36 NULL, /* init master */
37 NULL, /* init module */
38 NULL, /* init process */
39 NULL, /* init thread */
40 NULL, /* exit thread */
41 ngx_conf_flush_files, /* exit process */
42 NULL, /* exit master */
47 /* The eight fixed arguments */
49 static ngx_uint_t argument_number[] = {
62 ngx_conf_param(ngx_conf_t *cf)
66 ngx_conf_file_t conf_file;
68 param = &cf->cycle->conf_param;
70 if (param->len == 0) {
74 ngx_memzero(&conf_file, sizeof(ngx_conf_file_t));
76 ngx_memzero(&b, sizeof(ngx_buf_t));
78 b.start = param->data;
80 b.last = param->data + param->len;
84 conf_file.file.fd = NGX_INVALID_FILE;
85 conf_file.file.name.data = (u_char *) "command line";
88 cf->conf_file = &conf_file;
89 cf->conf_file->buffer = &b;
91 return ngx_conf_parse(cf, NULL);
96 ngx_conf_parse(ngx_conf_t *cf, ngx_str_t *filename)
102 ngx_conf_file_t *prev, conf_file;
109 #if (NGX_SUPPRESS_WARN)
110 fd = NGX_INVALID_FILE;
116 /* open configuration file */
118 fd = ngx_open_file(filename->data, NGX_FILE_RDONLY, NGX_FILE_OPEN, 0);
119 if (fd == NGX_INVALID_FILE) {
120 ngx_conf_log_error(NGX_LOG_EMERG, cf, ngx_errno,
121 ngx_open_file_n " \"%s\" failed",
123 return NGX_CONF_ERROR;
126 prev = cf->conf_file;
128 cf->conf_file = &conf_file;
130 if (ngx_fd_info(fd, &cf->conf_file->file.info) == -1) {
131 ngx_log_error(NGX_LOG_EMERG, cf->log, ngx_errno,
132 ngx_fd_info_n " \"%s\" failed", filename->data);
135 cf->conf_file->buffer = &buf;
137 buf.start = ngx_alloc(NGX_CONF_BUFFER, cf->log);
138 if (buf.start == NULL) {
143 buf.last = buf.start;
144 buf.end = buf.last + NGX_CONF_BUFFER;
147 cf->conf_file->file.fd = fd;
148 cf->conf_file->file.name.len = filename->len;
149 cf->conf_file->file.name.data = filename->data;
150 cf->conf_file->file.offset = 0;
151 cf->conf_file->file.log = cf->log;
152 cf->conf_file->line = 1;
156 } else if (cf->conf_file->file.fd != NGX_INVALID_FILE) {
166 rc = ngx_conf_read_token(cf);
169 * ngx_conf_read_token() may return
171 * NGX_ERROR there is error
172 * NGX_OK the token terminated by ";" was found
173 * NGX_CONF_BLOCK_START the token terminated by "{" was found
174 * NGX_CONF_BLOCK_DONE the "}" was found
175 * NGX_CONF_FILE_DONE the configuration file is done
178 if (rc == NGX_ERROR) {
182 if (rc == NGX_CONF_BLOCK_DONE) {
184 if (type != parse_block) {
185 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, "unexpected \"}\"");
192 if (rc == NGX_CONF_FILE_DONE) {
194 if (type == parse_block) {
195 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
196 "unexpected end of file, expecting \"}\"");
203 if (rc == NGX_CONF_BLOCK_START) {
205 if (type == parse_param) {
206 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
207 "block directives are not supported "
213 /* rc == NGX_OK || rc == NGX_CONF_BLOCK_START */
218 * the custom handler, i.e., that is used in the http's
219 * "types { ... }" directive
222 rv = (*cf->handler)(cf, NULL, cf->handler_conf);
223 if (rv == NGX_CONF_OK) {
227 if (rv == NGX_CONF_ERROR) {
231 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, rv);
237 rc = ngx_conf_handler(cf, rc);
239 if (rc == NGX_ERROR) {
251 if (cf->conf_file->buffer->start) {
252 ngx_free(cf->conf_file->buffer->start);
255 if (ngx_close_file(fd) == NGX_FILE_ERROR) {
256 ngx_log_error(NGX_LOG_ALERT, cf->log, ngx_errno,
257 ngx_close_file_n " %s failed",
258 cf->conf_file->file.name.data);
259 return NGX_CONF_ERROR;
262 cf->conf_file = prev;
265 if (rc == NGX_ERROR) {
266 return NGX_CONF_ERROR;
274 ngx_conf_handler(ngx_conf_t *cf, ngx_int_t last)
282 name = cf->args->elts;
286 for (i = 0; ngx_modules[i]; i++) {
288 /* look up the directive in the appropriate modules */
290 if (ngx_modules[i]->type != NGX_CONF_MODULE
291 && ngx_modules[i]->type != cf->module_type)
296 cmd = ngx_modules[i]->commands;
301 for ( /* void */ ; cmd->name.len; cmd++) {
303 if (name->len != cmd->name.len) {
307 if (ngx_strcmp(name->data, cmd->name.data) != 0) {
312 /* is the directive's location right ? */
314 if (!(cmd->type & cf->cmd_type)) {
315 if (cmd->type & NGX_CONF_MULTI) {
323 if (!(cmd->type & NGX_CONF_BLOCK) && last != NGX_OK) {
324 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
325 "directive \"%s\" is not terminated by \";\"",
330 if ((cmd->type & NGX_CONF_BLOCK) && last != NGX_CONF_BLOCK_START) {
331 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
332 "directive \"%s\" has no opening \"{\"",
337 /* is the directive's argument count right ? */
339 if (!(cmd->type & NGX_CONF_ANY)) {
341 if (cmd->type & NGX_CONF_FLAG) {
343 if (cf->args->nelts != 2) {
347 } else if (cmd->type & NGX_CONF_1MORE) {
349 if (cf->args->nelts < 2) {
353 } else if (cmd->type & NGX_CONF_2MORE) {
355 if (cf->args->nelts < 3) {
359 } else if (cf->args->nelts > NGX_CONF_MAX_ARGS) {
363 } else if (!(cmd->type & argument_number[cf->args->nelts - 1]))
369 /* set up the directive's configuration context */
373 if (cmd->type & NGX_DIRECT_CONF) {
374 conf = ((void **) cf->ctx)[ngx_modules[i]->index];
376 } else if (cmd->type & NGX_MAIN_CONF) {
377 conf = &(((void **) cf->ctx)[ngx_modules[i]->index]);
379 } else if (cf->ctx) {
380 confp = *(void **) ((char *) cf->ctx + cmd->conf);
383 conf = confp[ngx_modules[i]->ctx_index];
387 rv = cmd->set(cf, cmd, conf);
389 if (rv == NGX_CONF_OK) {
393 if (rv == NGX_CONF_ERROR) {
397 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
398 "\"%s\" directive %s", name->data, rv);
405 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
406 "unknown directive \"%s\"", name->data);
413 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
414 "\"%s\" directive is not allowed here", name->data);
419 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
420 "invalid number of arguments in \"%s\" directive",
428 ngx_conf_read_token(ngx_conf_t *cf)
430 u_char *start, ch, *src, *dst;
434 ngx_uint_t found, need_space, last_space, sharp_comment, variable;
435 ngx_uint_t quoted, s_quoted, d_quoted, start_line;
444 quoted = s_quoted = d_quoted = 0;
447 b = cf->conf_file->buffer;
449 start_line = cf->conf_file->line;
451 file_size = ngx_file_size(&cf->conf_file->file.info);
455 if (b->pos >= b->last) {
457 if (cf->conf_file->file.offset >= file_size) {
459 if (cf->args->nelts > 0) {
461 if (cf->conf_file->file.fd == NGX_INVALID_FILE) {
462 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
463 "unexpected end of parameter, "
468 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
469 "unexpected end of file, "
470 "expecting \";\" or \"}\"");
474 return NGX_CONF_FILE_DONE;
477 len = b->pos - start;
479 if (len == NGX_CONF_BUFFER) {
480 cf->conf_file->line = start_line;
485 } else if (s_quoted) {
489 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
490 "too long parameter \"%*s...\" started",
495 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
496 "too long parameter, probably "
497 "missing terminating \"%c\" character", ch);
502 ngx_memcpy(b->start, start, len);
505 size = (ssize_t) (file_size - cf->conf_file->file.offset);
507 if (size > b->end - (b->start + len)) {
508 size = b->end - (b->start + len);
511 n = ngx_read_file(&cf->conf_file->file, b->start + len, size,
512 cf->conf_file->file.offset);
514 if (n == NGX_ERROR) {
519 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
520 ngx_read_file_n " returned "
521 "only %z bytes instead of %z",
526 b->pos = b->start + len;
527 b->last = b->pos + n;
534 cf->conf_file->line++;
551 if (ch == ' ' || ch == '\t' || ch == CR || ch == LF) {
562 return NGX_CONF_BLOCK_START;
570 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
571 "unexpected \"%c\"", ch);
577 if (ch == ' ' || ch == '\t' || ch == CR || ch == LF) {
582 start_line = cf->conf_file->line;
588 if (cf->args->nelts == 0) {
589 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
590 "unexpected \"%c\"", ch);
595 return NGX_CONF_BLOCK_START;
601 if (cf->args->nelts != 0) {
602 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
607 return NGX_CONF_BLOCK_DONE;
635 if (ch == '{' && variable) {
658 } else if (s_quoted) {
665 } else if (ch == ' ' || ch == '\t' || ch == CR || ch == LF
666 || ch == ';' || ch == '{') {
672 word = ngx_array_push(cf->args);
677 word->data = ngx_pnalloc(cf->pool, b->pos - start + 1);
678 if (word->data == NULL) {
682 for (dst = word->data, src = start, len = 0;
721 return NGX_CONF_BLOCK_START;
732 ngx_conf_include(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
736 ngx_str_t *value, file, name;
739 value = cf->args->elts;
742 ngx_log_debug1(NGX_LOG_DEBUG_CORE, cf->log, 0, "include %s", file.data);
744 if (ngx_conf_full_name(cf->cycle, &file, 1) == NGX_ERROR) {
745 return NGX_CONF_ERROR;
748 if (strpbrk((char *) file.data, "*?[") == NULL) {
750 ngx_log_debug1(NGX_LOG_DEBUG_CORE, cf->log, 0, "include %s", file.data);
752 return ngx_conf_parse(cf, &file);
755 ngx_memzero(&gl, sizeof(ngx_glob_t));
757 gl.pattern = file.data;
761 if (ngx_open_glob(&gl) != NGX_OK) {
762 ngx_conf_log_error(NGX_LOG_EMERG, cf, ngx_errno,
763 ngx_open_glob_n " \"%s\" failed", file.data);
764 return NGX_CONF_ERROR;
770 n = ngx_read_glob(&gl, &name);
776 file.len = name.len++;
777 file.data = ngx_pstrdup(cf->pool, &name);
779 ngx_log_debug1(NGX_LOG_DEBUG_CORE, cf->log, 0, "include %s", file.data);
781 rv = ngx_conf_parse(cf, &file);
783 if (rv != NGX_CONF_OK) {
795 ngx_conf_full_name(ngx_cycle_t *cycle, ngx_str_t *name, ngx_uint_t conf_prefix)
801 if (name->data[0] == '/') {
808 && name->data[1] == ':'
809 && ((name->data[0] >= 'a' && name->data[0] <= 'z')
810 || (name->data[0] >= 'A' && name->data[0] <= 'Z')))
820 len = sizeof(NGX_CONF_PREFIX) - 1;
821 prefix = (u_char *) NGX_CONF_PREFIX;
824 len = cycle->root.len;
825 prefix = cycle->root.data;
828 name->len = len + old.len;
829 name->data = ngx_pnalloc(cycle->pool, name->len + 1);
830 if (name->data == NULL) {
834 p = ngx_cpymem(name->data, prefix, len);
835 ngx_cpystrn(p, old.data, old.len + 1);
842 ngx_conf_open_file(ngx_cycle_t *cycle, ngx_str_t *name)
846 ngx_list_part_t *part;
847 ngx_open_file_t *file;
849 #if (NGX_SUPPRESS_WARN)
857 if (ngx_conf_full_name(cycle, &full, 0) == NGX_ERROR) {
861 part = &cycle->open_files.part;
864 for (i = 0; /* void */ ; i++) {
866 if (i >= part->nelts) {
867 if (part->next == NULL) {
875 if (full.len != file[i].name.len) {
879 if (ngx_strcmp(full.data, file[i].name.data) == 0) {
885 file = ngx_list_push(&cycle->open_files);
891 file->fd = NGX_INVALID_FILE;
895 file->fd = ngx_stderr_fileno;
897 file->name.data = NULL;
907 ngx_conf_flush_files(ngx_cycle_t *cycle)
911 ngx_list_part_t *part;
912 ngx_open_file_t *file;
914 ngx_log_debug0(NGX_LOG_DEBUG_CORE, cycle->log, 0, "flush files");
916 part = &cycle->open_files.part;
919 for (i = 0; /* void */ ; i++) {
921 if (i >= part->nelts) {
922 if (part->next == NULL) {
930 len = file[i].pos - file[i].buffer;
932 if (file[i].buffer == NULL || len == 0) {
936 n = ngx_write_fd(file[i].fd, file[i].buffer, len);
938 if (n == NGX_FILE_ERROR) {
939 ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno,
940 ngx_write_fd_n " to \"%s\" failed",
943 } else if (n != len) {
944 ngx_log_error(NGX_LOG_ALERT, cycle->log, 0,
945 ngx_write_fd_n " to \"%s\" was incomplete: %z of %uz",
946 file[i].name.data, n, len);
953 ngx_conf_log_error(ngx_uint_t level, ngx_conf_t *cf, ngx_err_t err,
956 u_char errstr[NGX_MAX_CONF_ERRSTR], *p, *last;
959 last = errstr + NGX_MAX_CONF_ERRSTR;
962 p = ngx_vsnprintf(errstr, last - errstr, fmt, args);
969 /* leave a space for an error code */
978 p = ngx_snprintf(p, last - p, ((unsigned) err < 0x80000000)
979 ? " (%d: " : " (%Xd: ", err);
981 p = ngx_snprintf(p, last - p, " (%d: ", err);
984 p = ngx_strerror_r(err, p, last - p);
989 if (cf->conf_file == NULL) {
990 ngx_log_error(level, cf->log, 0, "%*s", p - errstr, errstr);
994 ngx_log_error(level, cf->log, 0, "%*s in %s:%ui",
996 cf->conf_file->file.name.data, cf->conf_file->line);
1001 ngx_conf_set_flag_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
1007 ngx_conf_post_t *post;
1009 fp = (ngx_flag_t *) (p + cmd->offset);
1011 if (*fp != NGX_CONF_UNSET) {
1012 return "is duplicate";
1015 value = cf->args->elts;
1017 if (ngx_strcasecmp(value[1].data, (u_char *) "on") == 0) {
1020 } else if (ngx_strcasecmp(value[1].data, (u_char *) "off") == 0) {
1024 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
1025 "invalid value \"%s\" in \"%s\" directive, "
1026 "it must be \"on\" or \"off\"",
1027 value[1].data, cmd->name.data);
1028 return NGX_CONF_ERROR;
1033 return post->post_handler(cf, post, fp);
1041 ngx_conf_set_str_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
1045 ngx_str_t *field, *value;
1046 ngx_conf_post_t *post;
1048 field = (ngx_str_t *) (p + cmd->offset);
1051 return "is duplicate";
1054 value = cf->args->elts;
1060 return post->post_handler(cf, post, field);
1068 ngx_conf_set_str_array_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
1072 ngx_str_t *value, *s;
1074 ngx_conf_post_t *post;
1076 a = (ngx_array_t **) (p + cmd->offset);
1078 if (*a == NGX_CONF_UNSET_PTR) {
1079 *a = ngx_array_create(cf->pool, 4, sizeof(ngx_str_t));
1081 return NGX_CONF_ERROR;
1085 s = ngx_array_push(*a);
1087 return NGX_CONF_ERROR;
1090 value = cf->args->elts;
1096 return post->post_handler(cf, post, s);
1104 ngx_conf_set_keyval_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
1111 ngx_conf_post_t *post;
1113 a = (ngx_array_t **) (p + cmd->offset);
1116 *a = ngx_array_create(cf->pool, 4, sizeof(ngx_keyval_t));
1118 return NGX_CONF_ERROR;
1122 kv = ngx_array_push(*a);
1124 return NGX_CONF_ERROR;
1127 value = cf->args->elts;
1130 kv->value = value[2];
1134 return post->post_handler(cf, post, kv);
1142 ngx_conf_set_num_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
1148 ngx_conf_post_t *post;
1151 np = (ngx_int_t *) (p + cmd->offset);
1153 if (*np != NGX_CONF_UNSET) {
1154 return "is duplicate";
1157 value = cf->args->elts;
1158 *np = ngx_atoi(value[1].data, value[1].len);
1159 if (*np == NGX_ERROR) {
1160 return "invalid number";
1165 return post->post_handler(cf, post, np);
1173 ngx_conf_set_size_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
1179 ngx_conf_post_t *post;
1182 sp = (size_t *) (p + cmd->offset);
1183 if (*sp != NGX_CONF_UNSET_SIZE) {
1184 return "is duplicate";
1187 value = cf->args->elts;
1189 *sp = ngx_parse_size(&value[1]);
1190 if (*sp == (size_t) NGX_ERROR) {
1191 return "invalid value";
1196 return post->post_handler(cf, post, sp);
1204 ngx_conf_set_off_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
1210 ngx_conf_post_t *post;
1213 op = (off_t *) (p + cmd->offset);
1214 if (*op != NGX_CONF_UNSET) {
1215 return "is duplicate";
1218 value = cf->args->elts;
1220 *op = ngx_parse_offset(&value[1]);
1221 if (*op == (off_t) NGX_ERROR) {
1222 return "invalid value";
1227 return post->post_handler(cf, post, op);
1235 ngx_conf_set_msec_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
1241 ngx_conf_post_t *post;
1244 msp = (ngx_msec_t *) (p + cmd->offset);
1245 if (*msp != NGX_CONF_UNSET_MSEC) {
1246 return "is duplicate";
1249 value = cf->args->elts;
1251 *msp = ngx_parse_time(&value[1], 0);
1252 if (*msp == (ngx_msec_t) NGX_ERROR) {
1253 return "invalid value";
1256 if (*msp == (ngx_msec_t) NGX_PARSE_LARGE_TIME) {
1257 return "value must be less than 597 hours";
1262 return post->post_handler(cf, post, msp);
1270 ngx_conf_set_sec_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
1276 ngx_conf_post_t *post;
1279 sp = (time_t *) (p + cmd->offset);
1280 if (*sp != NGX_CONF_UNSET) {
1281 return "is duplicate";
1284 value = cf->args->elts;
1286 *sp = ngx_parse_time(&value[1], 1);
1287 if (*sp == NGX_ERROR) {
1288 return "invalid value";
1291 if (*sp == NGX_PARSE_LARGE_TIME) {
1292 return "value must be less than 68 years";
1297 return post->post_handler(cf, post, sp);
1305 ngx_conf_set_bufs_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
1313 bufs = (ngx_bufs_t *) (p + cmd->offset);
1315 return "is duplicate";
1318 value = cf->args->elts;
1320 bufs->num = ngx_atoi(value[1].data, value[1].len);
1321 if (bufs->num == NGX_ERROR || bufs->num == 0) {
1322 return "invalid value";
1325 bufs->size = ngx_parse_size(&value[2]);
1326 if (bufs->size == (size_t) NGX_ERROR || bufs->size == 0) {
1327 return "invalid value";
1335 ngx_conf_set_enum_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
1343 np = (ngx_uint_t *) (p + cmd->offset);
1345 if (*np != NGX_CONF_UNSET_UINT) {
1346 return "is duplicate";
1349 value = cf->args->elts;
1352 for (i = 0; e[i].name.len != 0; i++) {
1353 if (e[i].name.len != value[1].len
1354 || ngx_strcasecmp(e[i].name.data, value[1].data) != 0)
1364 ngx_conf_log_error(NGX_LOG_WARN, cf, 0,
1365 "invalid value \"%s\"", value[1].data);
1367 return NGX_CONF_ERROR;
1372 ngx_conf_set_bitmask_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
1376 ngx_uint_t *np, i, m;
1378 ngx_conf_bitmask_t *mask;
1381 np = (ngx_uint_t *) (p + cmd->offset);
1382 value = cf->args->elts;
1385 for (i = 1; i < cf->args->nelts; i++) {
1386 for (m = 0; mask[m].name.len != 0; m++) {
1388 if (mask[m].name.len != value[i].len
1389 || ngx_strcasecmp(mask[m].name.data, value[i].data) != 0)
1394 if (*np & mask[m].mask) {
1395 ngx_conf_log_error(NGX_LOG_WARN, cf, 0,
1396 "duplicate value \"%s\"", value[i].data);
1399 *np |= mask[m].mask;
1405 if (mask[m].name.len == 0) {
1406 ngx_conf_log_error(NGX_LOG_WARN, cf, 0,
1407 "invalid value \"%s\"", value[i].data);
1409 return NGX_CONF_ERROR;
1418 ngx_conf_unsupported(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
1420 return "unsupported on this platform";
1425 ngx_conf_deprecated(ngx_conf_t *cf, void *post, void *data)
1427 ngx_conf_deprecated_t *d = post;
1429 ngx_conf_log_error(NGX_LOG_WARN, cf, 0,
1430 "the \"%s\" directive is deprecated, "
1431 "use the \"%s\" directive instead",
1432 d->old_name, d->new_name);
1439 ngx_conf_check_num_bounds(ngx_conf_t *cf, void *post, void *data)
1441 ngx_conf_num_bounds_t *bounds = post;
1442 ngx_int_t *np = data;
1444 if (bounds->high == -1) {
1445 if (*np >= bounds->low) {
1449 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
1450 "value must be equal or more than %i", bounds->low);
1452 return NGX_CONF_ERROR;
1455 if (*np >= bounds->low && *np <= bounds->high) {
1459 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
1460 "value must be between %i and %i",
1461 bounds->low, bounds->high);
1463 return NGX_CONF_ERROR;