2002-09-11 23:18:33 +08:00
|
|
|
|
2004-09-28 16:34:51 +08:00
|
|
|
/*
|
2004-09-30 00:00:49 +08:00
|
|
|
* Copyright (C) Igor Sysoev
|
2012-01-18 23:07:43 +08:00
|
|
|
* Copyright (C) Nginx, Inc.
|
2004-09-28 16:34:51 +08:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
2002-09-11 23:18:33 +08:00
|
|
|
#include <ngx_config.h>
|
2002-12-19 15:08:55 +08:00
|
|
|
#include <ngx_core.h>
|
2002-12-03 00:09:40 +08:00
|
|
|
|
2008-09-01 21:59:11 +08:00
|
|
|
#define NGX_CONF_BUFFER 4096
|
2002-12-03 00:09:40 +08:00
|
|
|
|
2005-03-19 20:38:37 +08:00
|
|
|
static ngx_int_t ngx_conf_handler(ngx_conf_t *cf, ngx_int_t last);
|
2005-03-23 00:02:46 +08:00
|
|
|
static ngx_int_t ngx_conf_read_token(ngx_conf_t *cf);
|
2005-10-27 23:46:13 +08:00
|
|
|
static void ngx_conf_flush_files(ngx_cycle_t *cycle);
|
2004-05-18 23:29:08 +08:00
|
|
|
|
|
|
|
|
|
|
|
static ngx_command_t ngx_conf_commands[] = {
|
|
|
|
|
|
|
|
{ ngx_string("include"),
|
|
|
|
NGX_ANY_CONF|NGX_CONF_TAKE1,
|
|
|
|
ngx_conf_include,
|
|
|
|
0,
|
|
|
|
0,
|
|
|
|
NULL },
|
|
|
|
|
|
|
|
ngx_null_command
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
ngx_module_t ngx_conf_module = {
|
nginx-0.1.29-RELEASE import
*) Feature: the ngx_http_ssi_module supports "include virtual" command.
*) Feature: the ngx_http_ssi_module supports the condition command like
'if expr="$NAME"' and "else" and "endif" commands. Only one nested
level is supported.
*) Feature: the ngx_http_ssi_module supports the DATE_LOCAL and
DATE_GMT variables and "config timefmt" command.
*) Feature: the "ssi_ignore_recycled_buffers" directive.
*) Bugfix: the "echo" command did not show the default value for the
empty QUERY_STRING variable.
*) Change: the ngx_http_proxy_module was rewritten.
*) Feature: the "proxy_redirect", "proxy_pass_request_headers",
"proxy_pass_request_body", and "proxy_method" directives.
*) Feature: the "proxy_set_header" directive. The "proxy_x_var" was
canceled and must be replaced with the proxy_set_header directive.
*) Change: the "proxy_preserve_host" is canceled and must be replaced
with the "proxy_set_header Host $host" and the "proxy_redirect off"
directives, the "proxy_set_header Host $host:$proxy_port" directive
and the appropriate proxy_redirect directives.
*) Change: the "proxy_set_x_real_ip" is canceled and must be replaced
with the "proxy_set_header X-Real-IP $remote_addr" directive.
*) Change: the "proxy_add_x_forwarded_for" is canceled and must be
replaced with
the "proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for"
directive.
*) Change: the "proxy_set_x_url" is canceled and must be replaced with
the "proxy_set_header X-URL http://$host:$server_port$request_uri"
directive.
*) Feature: the "fastcgi_param" directive.
*) Change: the "fastcgi_root", "fastcgi_set_var" and "fastcgi_params"
directive are canceled and must be replaced with the fastcgi_param
directives.
*) Feature: the "index" directive can use the variables.
*) Feature: the "index" directive can be used at http and server levels.
*) Change: the last index only in the "index" directive can be absolute.
*) Feature: the "rewrite" directive can use the variables.
*) Feature: the "internal" directive.
*) Feature: the CONTENT_LENGTH, CONTENT_TYPE, REMOTE_PORT, SERVER_ADDR,
SERVER_PORT, SERVER_PROTOCOL, DOCUMENT_ROOT, SERVER_NAME,
REQUEST_METHOD, REQUEST_URI, and REMOTE_USER variables.
*) Change: nginx now passes the invalid lines in a client request
headers or a backend response header.
*) Bugfix: if the backend did not transfer response for a long time and
the "send_timeout" was less than "proxy_read_timeout", then nginx
returned the 408 response.
*) Bugfix: the segmentation fault was occurred if the backend sent an
invalid line in response header; the bug had appeared in 0.1.26.
*) Bugfix: the segmentation fault may occurred in FastCGI fault
tolerance configuration.
*) Bugfix: the "expires" directive did not remove the previous
"Expires" and "Cache-Control" headers.
*) Bugfix: nginx did not take into account trailing dot in "Host"
header line.
*) Bugfix: the ngx_http_auth_module did not work under Linux.
*) Bugfix: the rewrite directive worked incorrectly, if the arguments
were in a request.
*) Bugfix: nginx could not be built on MacOS X.
2005-05-12 22:58:06 +08:00
|
|
|
NGX_MODULE_V1,
|
2004-05-18 23:29:08 +08:00
|
|
|
NULL, /* module context */
|
|
|
|
ngx_conf_commands, /* module directives */
|
|
|
|
NGX_CONF_MODULE, /* module type */
|
2005-09-08 22:36:09 +08:00
|
|
|
NULL, /* init master */
|
2004-05-18 23:29:08 +08:00
|
|
|
NULL, /* init module */
|
2005-09-08 22:36:09 +08:00
|
|
|
NULL, /* init process */
|
|
|
|
NULL, /* init thread */
|
|
|
|
NULL, /* exit thread */
|
2005-10-27 23:46:13 +08:00
|
|
|
ngx_conf_flush_files, /* exit process */
|
2005-09-08 22:36:09 +08:00
|
|
|
NULL, /* exit master */
|
|
|
|
NGX_MODULE_V1_PADDING
|
2004-05-18 23:29:08 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2008-09-01 21:59:11 +08:00
|
|
|
/* The eight fixed arguments */
|
2003-10-23 00:38:26 +08:00
|
|
|
|
2008-08-27 05:04:06 +08:00
|
|
|
static ngx_uint_t argument_number[] = {
|
2002-12-03 00:09:40 +08:00
|
|
|
NGX_CONF_NOARGS,
|
|
|
|
NGX_CONF_TAKE1,
|
2003-10-23 00:38:26 +08:00
|
|
|
NGX_CONF_TAKE2,
|
|
|
|
NGX_CONF_TAKE3,
|
|
|
|
NGX_CONF_TAKE4,
|
|
|
|
NGX_CONF_TAKE5,
|
|
|
|
NGX_CONF_TAKE6,
|
2004-04-13 00:38:09 +08:00
|
|
|
NGX_CONF_TAKE7
|
2002-12-03 00:09:40 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2008-06-30 20:35:16 +08:00
|
|
|
char *
|
|
|
|
ngx_conf_param(ngx_conf_t *cf)
|
|
|
|
{
|
2009-04-29 04:06:03 +08:00
|
|
|
char *rv;
|
2008-06-30 20:35:16 +08:00
|
|
|
ngx_str_t *param;
|
|
|
|
ngx_buf_t b;
|
|
|
|
ngx_conf_file_t conf_file;
|
|
|
|
|
|
|
|
param = &cf->cycle->conf_param;
|
|
|
|
|
|
|
|
if (param->len == 0) {
|
|
|
|
return NGX_CONF_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
ngx_memzero(&conf_file, sizeof(ngx_conf_file_t));
|
|
|
|
|
|
|
|
ngx_memzero(&b, sizeof(ngx_buf_t));
|
|
|
|
|
|
|
|
b.start = param->data;
|
|
|
|
b.pos = param->data;
|
|
|
|
b.last = param->data + param->len;
|
|
|
|
b.end = b.last;
|
|
|
|
b.temporary = 1;
|
|
|
|
|
|
|
|
conf_file.file.fd = NGX_INVALID_FILE;
|
2009-04-29 04:06:03 +08:00
|
|
|
conf_file.file.name.data = NULL;
|
|
|
|
conf_file.line = 0;
|
2008-06-30 20:35:16 +08:00
|
|
|
|
|
|
|
cf->conf_file = &conf_file;
|
|
|
|
cf->conf_file->buffer = &b;
|
|
|
|
|
2009-04-29 04:06:03 +08:00
|
|
|
rv = ngx_conf_parse(cf, NULL);
|
|
|
|
|
|
|
|
cf->conf_file = NULL;
|
|
|
|
|
|
|
|
return rv;
|
2008-06-30 20:35:16 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-03-23 00:02:46 +08:00
|
|
|
char *
|
|
|
|
ngx_conf_parse(ngx_conf_t *cf, ngx_str_t *filename)
|
2002-12-03 00:09:40 +08:00
|
|
|
{
|
2003-01-09 13:36:00 +08:00
|
|
|
char *rv;
|
2002-12-26 15:24:21 +08:00
|
|
|
ngx_fd_t fd;
|
2005-03-19 20:38:37 +08:00
|
|
|
ngx_int_t rc;
|
2008-11-25 23:55:10 +08:00
|
|
|
ngx_buf_t buf;
|
|
|
|
ngx_conf_file_t *prev, conf_file;
|
2008-06-30 20:35:16 +08:00
|
|
|
enum {
|
|
|
|
parse_file = 0,
|
|
|
|
parse_block,
|
|
|
|
parse_param
|
|
|
|
} type;
|
2002-12-03 00:09:40 +08:00
|
|
|
|
2003-07-07 14:11:50 +08:00
|
|
|
#if (NGX_SUPPRESS_WARN)
|
|
|
|
fd = NGX_INVALID_FILE;
|
|
|
|
prev = NULL;
|
|
|
|
#endif
|
|
|
|
|
2002-12-03 00:09:40 +08:00
|
|
|
if (filename) {
|
2002-12-19 15:08:55 +08:00
|
|
|
|
2003-05-16 23:27:48 +08:00
|
|
|
/* open configuration file */
|
|
|
|
|
2007-01-19 04:15:09 +08:00
|
|
|
fd = ngx_open_file(filename->data, NGX_FILE_RDONLY, NGX_FILE_OPEN, 0);
|
2002-12-19 15:08:55 +08:00
|
|
|
if (fd == NGX_INVALID_FILE) {
|
2005-11-26 18:11:11 +08:00
|
|
|
ngx_conf_log_error(NGX_LOG_EMERG, cf, ngx_errno,
|
2005-12-27 01:07:48 +08:00
|
|
|
ngx_open_file_n " \"%s\" failed",
|
|
|
|
filename->data);
|
2003-01-09 13:36:00 +08:00
|
|
|
return NGX_CONF_ERROR;
|
2002-12-19 15:08:55 +08:00
|
|
|
}
|
|
|
|
|
2002-12-23 14:29:22 +08:00
|
|
|
prev = cf->conf_file;
|
2005-03-19 20:38:37 +08:00
|
|
|
|
2008-11-25 23:55:10 +08:00
|
|
|
cf->conf_file = &conf_file;
|
2002-12-19 15:08:55 +08:00
|
|
|
|
2013-03-25 23:49:11 +08:00
|
|
|
if (ngx_fd_info(fd, &cf->conf_file->file.info) == NGX_FILE_ERROR) {
|
2002-12-23 14:29:22 +08:00
|
|
|
ngx_log_error(NGX_LOG_EMERG, cf->log, ngx_errno,
|
2004-11-11 22:07:14 +08:00
|
|
|
ngx_fd_info_n " \"%s\" failed", filename->data);
|
2002-12-23 14:29:22 +08:00
|
|
|
}
|
|
|
|
|
2008-11-25 23:55:10 +08:00
|
|
|
cf->conf_file->buffer = &buf;
|
2006-04-05 21:40:54 +08:00
|
|
|
|
2008-11-25 23:55:10 +08:00
|
|
|
buf.start = ngx_alloc(NGX_CONF_BUFFER, cf->log);
|
|
|
|
if (buf.start == NULL) {
|
|
|
|
goto failed;
|
2006-04-05 21:40:54 +08:00
|
|
|
}
|
|
|
|
|
2008-11-25 23:55:10 +08:00
|
|
|
buf.pos = buf.start;
|
|
|
|
buf.last = buf.start;
|
|
|
|
buf.end = buf.last + NGX_CONF_BUFFER;
|
|
|
|
buf.temporary = 1;
|
2006-04-05 21:40:54 +08:00
|
|
|
|
2002-12-23 14:29:22 +08:00
|
|
|
cf->conf_file->file.fd = fd;
|
|
|
|
cf->conf_file->file.name.len = filename->len;
|
|
|
|
cf->conf_file->file.name.data = filename->data;
|
2003-07-07 14:11:50 +08:00
|
|
|
cf->conf_file->file.offset = 0;
|
2007-10-10 04:11:03 +08:00
|
|
|
cf->conf_file->file.log = cf->log;
|
2002-12-23 14:29:22 +08:00
|
|
|
cf->conf_file->line = 1;
|
2005-09-23 19:02:22 +08:00
|
|
|
|
2008-06-30 20:35:16 +08:00
|
|
|
type = parse_file;
|
|
|
|
|
|
|
|
} else if (cf->conf_file->file.fd != NGX_INVALID_FILE) {
|
|
|
|
|
|
|
|
type = parse_block;
|
2005-09-23 19:02:22 +08:00
|
|
|
|
|
|
|
} else {
|
2008-06-30 20:35:16 +08:00
|
|
|
type = parse_param;
|
2002-12-03 00:09:40 +08:00
|
|
|
}
|
|
|
|
|
2005-09-23 19:02:22 +08:00
|
|
|
|
2002-12-03 00:09:40 +08:00
|
|
|
for ( ;; ) {
|
|
|
|
rc = ngx_conf_read_token(cf);
|
|
|
|
|
2004-05-28 23:49:23 +08:00
|
|
|
/*
|
2004-11-11 22:07:14 +08:00
|
|
|
* ngx_conf_read_token() may return
|
2005-09-23 19:02:22 +08:00
|
|
|
*
|
2004-11-11 22:07:14 +08:00
|
|
|
* NGX_ERROR there is error
|
|
|
|
* NGX_OK the token terminated by ";" was found
|
|
|
|
* NGX_CONF_BLOCK_START the token terminated by "{" was found
|
|
|
|
* NGX_CONF_BLOCK_DONE the "}" was found
|
|
|
|
* NGX_CONF_FILE_DONE the configuration file is done
|
2004-05-28 23:49:23 +08:00
|
|
|
*/
|
2002-12-03 00:09:40 +08:00
|
|
|
|
2003-01-09 13:36:00 +08:00
|
|
|
if (rc == NGX_ERROR) {
|
2007-02-20 22:36:48 +08:00
|
|
|
goto done;
|
2003-01-09 13:36:00 +08:00
|
|
|
}
|
|
|
|
|
2005-09-23 19:02:22 +08:00
|
|
|
if (rc == NGX_CONF_BLOCK_DONE) {
|
2008-06-25 22:56:14 +08:00
|
|
|
|
2008-06-30 20:35:16 +08:00
|
|
|
if (type != parse_block) {
|
2007-02-20 22:33:26 +08:00
|
|
|
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, "unexpected \"}\"");
|
2007-02-20 22:36:48 +08:00
|
|
|
goto failed;
|
2007-02-20 22:33:26 +08:00
|
|
|
}
|
|
|
|
|
2008-06-25 22:56:14 +08:00
|
|
|
goto done;
|
2005-09-23 19:02:22 +08:00
|
|
|
}
|
|
|
|
|
2008-06-25 22:56:14 +08:00
|
|
|
if (rc == NGX_CONF_FILE_DONE) {
|
|
|
|
|
2008-06-30 20:35:16 +08:00
|
|
|
if (type == parse_block) {
|
2008-06-25 22:56:14 +08:00
|
|
|
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
|
|
|
|
"unexpected end of file, expecting \"}\"");
|
|
|
|
goto failed;
|
|
|
|
}
|
2005-09-23 19:02:22 +08:00
|
|
|
|
2007-02-20 22:36:48 +08:00
|
|
|
goto done;
|
2002-12-19 15:08:55 +08:00
|
|
|
}
|
|
|
|
|
2008-06-30 20:35:16 +08:00
|
|
|
if (rc == NGX_CONF_BLOCK_START) {
|
|
|
|
|
|
|
|
if (type == parse_param) {
|
|
|
|
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
|
|
|
|
"block directives are not supported "
|
|
|
|
"in -g option");
|
|
|
|
goto failed;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-06-25 22:56:14 +08:00
|
|
|
/* rc == NGX_OK || rc == NGX_CONF_BLOCK_START */
|
|
|
|
|
2002-12-19 15:08:55 +08:00
|
|
|
if (cf->handler) {
|
2002-12-03 00:09:40 +08:00
|
|
|
|
2004-11-11 22:07:14 +08:00
|
|
|
/*
|
|
|
|
* the custom handler, i.e., that is used in the http's
|
|
|
|
* "types { ... }" directive
|
|
|
|
*/
|
2003-05-16 23:27:48 +08:00
|
|
|
|
2013-05-24 00:30:27 +08:00
|
|
|
if (rc == NGX_CONF_BLOCK_START) {
|
|
|
|
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, "unexpected \"{\"");
|
|
|
|
goto failed;
|
|
|
|
}
|
|
|
|
|
2003-05-15 01:13:13 +08:00
|
|
|
rv = (*cf->handler)(cf, NULL, cf->handler_conf);
|
|
|
|
if (rv == NGX_CONF_OK) {
|
|
|
|
continue;
|
2005-03-19 20:38:37 +08:00
|
|
|
}
|
2003-05-15 01:13:13 +08:00
|
|
|
|
2005-03-19 20:38:37 +08:00
|
|
|
if (rv == NGX_CONF_ERROR) {
|
2007-02-20 22:36:48 +08:00
|
|
|
goto failed;
|
2003-05-15 01:13:13 +08:00
|
|
|
}
|
2005-03-19 20:38:37 +08:00
|
|
|
|
2007-02-20 23:47:54 +08:00
|
|
|
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, rv);
|
2007-02-20 22:36:48 +08:00
|
|
|
|
|
|
|
goto failed;
|
2002-12-19 15:08:55 +08:00
|
|
|
}
|
2002-12-03 00:09:40 +08:00
|
|
|
|
2002-12-27 00:26:23 +08:00
|
|
|
|
2005-03-19 20:38:37 +08:00
|
|
|
rc = ngx_conf_handler(cf, rc);
|
2003-05-16 23:27:48 +08:00
|
|
|
|
2005-03-19 20:38:37 +08:00
|
|
|
if (rc == NGX_ERROR) {
|
2007-02-20 22:36:48 +08:00
|
|
|
goto failed;
|
2005-03-19 20:38:37 +08:00
|
|
|
}
|
|
|
|
}
|
2003-05-16 23:27:48 +08:00
|
|
|
|
2007-02-20 22:36:48 +08:00
|
|
|
failed:
|
|
|
|
|
|
|
|
rc = NGX_ERROR;
|
|
|
|
|
|
|
|
done:
|
2002-12-27 00:26:23 +08:00
|
|
|
|
2005-03-19 20:38:37 +08:00
|
|
|
if (filename) {
|
2008-11-25 23:55:10 +08:00
|
|
|
if (cf->conf_file->buffer->start) {
|
|
|
|
ngx_free(cf->conf_file->buffer->start);
|
|
|
|
}
|
2005-12-05 21:18:09 +08:00
|
|
|
|
2005-03-19 20:38:37 +08:00
|
|
|
if (ngx_close_file(fd) == NGX_FILE_ERROR) {
|
|
|
|
ngx_log_error(NGX_LOG_ALERT, cf->log, ngx_errno,
|
|
|
|
ngx_close_file_n " %s failed",
|
2009-11-06 01:10:48 +08:00
|
|
|
filename->data);
|
2005-03-19 20:38:37 +08:00
|
|
|
return NGX_CONF_ERROR;
|
|
|
|
}
|
2008-11-25 22:45:44 +08:00
|
|
|
|
|
|
|
cf->conf_file = prev;
|
2005-03-19 20:38:37 +08:00
|
|
|
}
|
2002-12-28 00:22:50 +08:00
|
|
|
|
2005-03-19 20:38:37 +08:00
|
|
|
if (rc == NGX_ERROR) {
|
|
|
|
return NGX_CONF_ERROR;
|
|
|
|
}
|
2005-01-25 20:27:35 +08:00
|
|
|
|
2005-03-19 20:38:37 +08:00
|
|
|
return NGX_CONF_OK;
|
|
|
|
}
|
2003-05-15 01:13:13 +08:00
|
|
|
|
2004-11-11 22:07:14 +08:00
|
|
|
|
2005-03-23 00:02:46 +08:00
|
|
|
static ngx_int_t
|
|
|
|
ngx_conf_handler(ngx_conf_t *cf, ngx_int_t last)
|
2005-03-19 20:38:37 +08:00
|
|
|
{
|
|
|
|
char *rv;
|
|
|
|
void *conf, **confp;
|
2012-07-30 03:59:06 +08:00
|
|
|
ngx_uint_t i, found;
|
2005-03-19 20:38:37 +08:00
|
|
|
ngx_str_t *name;
|
|
|
|
ngx_command_t *cmd;
|
2004-11-11 22:07:14 +08:00
|
|
|
|
2005-03-19 20:38:37 +08:00
|
|
|
name = cf->args->elts;
|
2003-05-16 23:27:48 +08:00
|
|
|
|
2012-07-30 03:59:06 +08:00
|
|
|
found = 0;
|
2006-05-04 23:32:46 +08:00
|
|
|
|
2005-03-19 20:38:37 +08:00
|
|
|
for (i = 0; ngx_modules[i]; i++) {
|
2003-05-30 22:27:59 +08:00
|
|
|
|
2005-03-19 20:38:37 +08:00
|
|
|
cmd = ngx_modules[i]->commands;
|
|
|
|
if (cmd == NULL) {
|
|
|
|
continue;
|
|
|
|
}
|
2003-05-30 22:27:59 +08:00
|
|
|
|
2006-05-04 23:32:46 +08:00
|
|
|
for ( /* void */ ; cmd->name.len; cmd++) {
|
2003-11-10 04:03:38 +08:00
|
|
|
|
2006-05-04 23:32:46 +08:00
|
|
|
if (name->len != cmd->name.len) {
|
|
|
|
continue;
|
|
|
|
}
|
2003-11-10 04:03:38 +08:00
|
|
|
|
2006-05-04 23:32:46 +08:00
|
|
|
if (ngx_strcmp(name->data, cmd->name.data) != 0) {
|
|
|
|
continue;
|
|
|
|
}
|
2003-05-30 22:27:59 +08:00
|
|
|
|
2012-07-30 03:59:06 +08:00
|
|
|
found = 1;
|
|
|
|
|
|
|
|
if (ngx_modules[i]->type != NGX_CONF_MODULE
|
|
|
|
&& ngx_modules[i]->type != cf->module_type)
|
|
|
|
{
|
|
|
|
continue;
|
|
|
|
}
|
2003-05-30 22:27:59 +08:00
|
|
|
|
2006-05-04 23:32:46 +08:00
|
|
|
/* is the directive's location right ? */
|
|
|
|
|
|
|
|
if (!(cmd->type & cf->cmd_type)) {
|
2012-07-30 03:59:06 +08:00
|
|
|
continue;
|
2006-05-04 23:32:46 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
if (!(cmd->type & NGX_CONF_BLOCK) && last != NGX_OK) {
|
2007-02-20 23:47:54 +08:00
|
|
|
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
|
|
|
|
"directive \"%s\" is not terminated by \";\"",
|
|
|
|
name->data);
|
2006-05-04 23:32:46 +08:00
|
|
|
return NGX_ERROR;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((cmd->type & NGX_CONF_BLOCK) && last != NGX_CONF_BLOCK_START) {
|
2007-02-20 23:47:54 +08:00
|
|
|
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
|
|
|
|
"directive \"%s\" has no opening \"{\"",
|
|
|
|
name->data);
|
2006-05-04 23:32:46 +08:00
|
|
|
return NGX_ERROR;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* is the directive's argument count right ? */
|
2005-03-19 20:38:37 +08:00
|
|
|
|
2006-05-04 23:32:46 +08:00
|
|
|
if (!(cmd->type & NGX_CONF_ANY)) {
|
2005-03-19 20:38:37 +08:00
|
|
|
|
2006-05-04 23:32:46 +08:00
|
|
|
if (cmd->type & NGX_CONF_FLAG) {
|
2005-03-19 20:38:37 +08:00
|
|
|
|
2006-05-04 23:32:46 +08:00
|
|
|
if (cf->args->nelts != 2) {
|
|
|
|
goto invalid;
|
2003-05-30 22:27:59 +08:00
|
|
|
}
|
|
|
|
|
2005-03-19 20:38:37 +08:00
|
|
|
} else if (cmd->type & NGX_CONF_1MORE) {
|
|
|
|
|
2006-05-04 23:32:46 +08:00
|
|
|
if (cf->args->nelts < 2) {
|
|
|
|
goto invalid;
|
2003-01-09 13:36:00 +08:00
|
|
|
}
|
2002-12-19 15:08:55 +08:00
|
|
|
|
2005-03-19 20:38:37 +08:00
|
|
|
} else if (cmd->type & NGX_CONF_2MORE) {
|
2003-05-16 23:27:48 +08:00
|
|
|
|
2006-05-04 23:32:46 +08:00
|
|
|
if (cf->args->nelts < 3) {
|
|
|
|
goto invalid;
|
2005-03-19 20:38:37 +08:00
|
|
|
}
|
2003-05-16 23:27:48 +08:00
|
|
|
|
2006-05-04 23:32:46 +08:00
|
|
|
} else if (cf->args->nelts > NGX_CONF_MAX_ARGS) {
|
2004-04-13 00:38:09 +08:00
|
|
|
|
2006-05-04 23:32:46 +08:00
|
|
|
goto invalid;
|
2005-03-19 20:38:37 +08:00
|
|
|
|
2006-05-04 23:32:46 +08:00
|
|
|
} else if (!(cmd->type & argument_number[cf->args->nelts - 1]))
|
|
|
|
{
|
|
|
|
goto invalid;
|
2005-03-19 20:38:37 +08:00
|
|
|
}
|
2006-05-04 23:32:46 +08:00
|
|
|
}
|
2003-05-16 23:27:48 +08:00
|
|
|
|
2006-05-04 23:32:46 +08:00
|
|
|
/* set up the directive's configuration context */
|
2002-12-03 00:09:40 +08:00
|
|
|
|
2006-05-04 23:32:46 +08:00
|
|
|
conf = NULL;
|
2002-12-03 00:09:40 +08:00
|
|
|
|
2006-05-04 23:32:46 +08:00
|
|
|
if (cmd->type & NGX_DIRECT_CONF) {
|
|
|
|
conf = ((void **) cf->ctx)[ngx_modules[i]->index];
|
2002-12-03 00:09:40 +08:00
|
|
|
|
2006-05-04 23:32:46 +08:00
|
|
|
} else if (cmd->type & NGX_MAIN_CONF) {
|
|
|
|
conf = &(((void **) cf->ctx)[ngx_modules[i]->index]);
|
2002-12-03 00:09:40 +08:00
|
|
|
|
2006-05-04 23:32:46 +08:00
|
|
|
} else if (cf->ctx) {
|
|
|
|
confp = *(void **) ((char *) cf->ctx + cmd->conf);
|
2002-12-03 00:09:40 +08:00
|
|
|
|
2006-05-04 23:32:46 +08:00
|
|
|
if (confp) {
|
|
|
|
conf = confp[ngx_modules[i]->ctx_index];
|
2005-03-19 20:38:37 +08:00
|
|
|
}
|
2006-05-04 23:32:46 +08:00
|
|
|
}
|
2003-01-09 13:36:00 +08:00
|
|
|
|
2006-05-04 23:32:46 +08:00
|
|
|
rv = cmd->set(cf, cmd, conf);
|
2003-07-18 22:44:05 +08:00
|
|
|
|
2006-05-04 23:32:46 +08:00
|
|
|
if (rv == NGX_CONF_OK) {
|
|
|
|
return NGX_OK;
|
|
|
|
}
|
2002-12-03 00:09:40 +08:00
|
|
|
|
2006-05-04 23:32:46 +08:00
|
|
|
if (rv == NGX_CONF_ERROR) {
|
2005-03-19 20:38:37 +08:00
|
|
|
return NGX_ERROR;
|
|
|
|
}
|
2002-12-19 15:08:55 +08:00
|
|
|
|
2007-02-20 23:47:54 +08:00
|
|
|
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
|
2007-06-05 19:55:39 +08:00
|
|
|
"\"%s\" directive %s", name->data, rv);
|
2006-05-04 23:32:46 +08:00
|
|
|
|
|
|
|
return NGX_ERROR;
|
2002-12-19 15:08:55 +08:00
|
|
|
}
|
2002-12-03 00:09:40 +08:00
|
|
|
}
|
2002-12-19 15:08:55 +08:00
|
|
|
|
2012-07-30 03:59:06 +08:00
|
|
|
if (found) {
|
2007-02-20 23:47:54 +08:00
|
|
|
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
|
2012-07-30 03:59:06 +08:00
|
|
|
"\"%s\" directive is not allowed here", name->data);
|
2006-05-04 23:32:46 +08:00
|
|
|
|
|
|
|
return NGX_ERROR;
|
|
|
|
}
|
|
|
|
|
2007-02-20 23:47:54 +08:00
|
|
|
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
|
2012-07-30 03:59:06 +08:00
|
|
|
"unknown directive \"%s\"", name->data);
|
|
|
|
|
2006-05-04 23:32:46 +08:00
|
|
|
return NGX_ERROR;
|
|
|
|
|
|
|
|
invalid:
|
|
|
|
|
2007-02-20 23:47:54 +08:00
|
|
|
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
|
2007-08-31 14:15:50 +08:00
|
|
|
"invalid number of arguments in \"%s\" directive",
|
2007-02-20 23:47:54 +08:00
|
|
|
name->data);
|
2003-07-07 14:11:50 +08:00
|
|
|
|
2005-03-19 20:38:37 +08:00
|
|
|
return NGX_ERROR;
|
2002-12-23 14:29:22 +08:00
|
|
|
}
|
2002-12-03 00:09:40 +08:00
|
|
|
|
2002-12-19 15:08:55 +08:00
|
|
|
|
2005-03-23 00:02:46 +08:00
|
|
|
static ngx_int_t
|
|
|
|
ngx_conf_read_token(ngx_conf_t *cf)
|
2002-12-03 00:09:40 +08:00
|
|
|
{
|
2004-03-16 15:10:12 +08:00
|
|
|
u_char *start, ch, *src, *dst;
|
2008-09-01 21:59:11 +08:00
|
|
|
off_t file_size;
|
2008-08-27 05:04:06 +08:00
|
|
|
size_t len;
|
2008-09-01 21:59:11 +08:00
|
|
|
ssize_t n, size;
|
2008-08-27 05:04:06 +08:00
|
|
|
ngx_uint_t found, need_space, last_space, sharp_comment, variable;
|
2008-08-27 05:10:20 +08:00
|
|
|
ngx_uint_t quoted, s_quoted, d_quoted, start_line;
|
2002-12-23 14:29:22 +08:00
|
|
|
ngx_str_t *word;
|
2004-05-28 23:49:23 +08:00
|
|
|
ngx_buf_t *b;
|
2002-12-03 00:09:40 +08:00
|
|
|
|
2002-12-23 14:29:22 +08:00
|
|
|
found = 0;
|
2002-12-03 00:09:40 +08:00
|
|
|
need_space = 0;
|
|
|
|
last_space = 1;
|
2002-12-26 15:24:21 +08:00
|
|
|
sharp_comment = 0;
|
nginx-0.1.29-RELEASE import
*) Feature: the ngx_http_ssi_module supports "include virtual" command.
*) Feature: the ngx_http_ssi_module supports the condition command like
'if expr="$NAME"' and "else" and "endif" commands. Only one nested
level is supported.
*) Feature: the ngx_http_ssi_module supports the DATE_LOCAL and
DATE_GMT variables and "config timefmt" command.
*) Feature: the "ssi_ignore_recycled_buffers" directive.
*) Bugfix: the "echo" command did not show the default value for the
empty QUERY_STRING variable.
*) Change: the ngx_http_proxy_module was rewritten.
*) Feature: the "proxy_redirect", "proxy_pass_request_headers",
"proxy_pass_request_body", and "proxy_method" directives.
*) Feature: the "proxy_set_header" directive. The "proxy_x_var" was
canceled and must be replaced with the proxy_set_header directive.
*) Change: the "proxy_preserve_host" is canceled and must be replaced
with the "proxy_set_header Host $host" and the "proxy_redirect off"
directives, the "proxy_set_header Host $host:$proxy_port" directive
and the appropriate proxy_redirect directives.
*) Change: the "proxy_set_x_real_ip" is canceled and must be replaced
with the "proxy_set_header X-Real-IP $remote_addr" directive.
*) Change: the "proxy_add_x_forwarded_for" is canceled and must be
replaced with
the "proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for"
directive.
*) Change: the "proxy_set_x_url" is canceled and must be replaced with
the "proxy_set_header X-URL http://$host:$server_port$request_uri"
directive.
*) Feature: the "fastcgi_param" directive.
*) Change: the "fastcgi_root", "fastcgi_set_var" and "fastcgi_params"
directive are canceled and must be replaced with the fastcgi_param
directives.
*) Feature: the "index" directive can use the variables.
*) Feature: the "index" directive can be used at http and server levels.
*) Change: the last index only in the "index" directive can be absolute.
*) Feature: the "rewrite" directive can use the variables.
*) Feature: the "internal" directive.
*) Feature: the CONTENT_LENGTH, CONTENT_TYPE, REMOTE_PORT, SERVER_ADDR,
SERVER_PORT, SERVER_PROTOCOL, DOCUMENT_ROOT, SERVER_NAME,
REQUEST_METHOD, REQUEST_URI, and REMOTE_USER variables.
*) Change: nginx now passes the invalid lines in a client request
headers or a backend response header.
*) Bugfix: if the backend did not transfer response for a long time and
the "send_timeout" was less than "proxy_read_timeout", then nginx
returned the 408 response.
*) Bugfix: the segmentation fault was occurred if the backend sent an
invalid line in response header; the bug had appeared in 0.1.26.
*) Bugfix: the segmentation fault may occurred in FastCGI fault
tolerance configuration.
*) Bugfix: the "expires" directive did not remove the previous
"Expires" and "Cache-Control" headers.
*) Bugfix: nginx did not take into account trailing dot in "Host"
header line.
*) Bugfix: the ngx_http_auth_module did not work under Linux.
*) Bugfix: the rewrite directive worked incorrectly, if the arguments
were in a request.
*) Bugfix: nginx could not be built on MacOS X.
2005-05-12 22:58:06 +08:00
|
|
|
variable = 0;
|
2009-05-15 00:24:39 +08:00
|
|
|
quoted = 0;
|
|
|
|
s_quoted = 0;
|
|
|
|
d_quoted = 0;
|
2002-12-03 00:09:40 +08:00
|
|
|
|
|
|
|
cf->args->nelts = 0;
|
2004-05-28 23:49:23 +08:00
|
|
|
b = cf->conf_file->buffer;
|
|
|
|
start = b->pos;
|
2008-08-27 05:10:20 +08:00
|
|
|
start_line = cf->conf_file->line;
|
2002-12-19 15:08:55 +08:00
|
|
|
|
2008-09-01 21:59:11 +08:00
|
|
|
file_size = ngx_file_size(&cf->conf_file->file.info);
|
|
|
|
|
2002-12-24 02:22:18 +08:00
|
|
|
for ( ;; ) {
|
2002-12-19 15:08:55 +08:00
|
|
|
|
2004-05-28 23:49:23 +08:00
|
|
|
if (b->pos >= b->last) {
|
2008-06-30 20:35:16 +08:00
|
|
|
|
2008-09-01 21:59:11 +08:00
|
|
|
if (cf->conf_file->file.offset >= file_size) {
|
|
|
|
|
2012-04-18 21:30:43 +08:00
|
|
|
if (cf->args->nelts > 0 || !last_space) {
|
2008-06-30 20:35:16 +08:00
|
|
|
|
|
|
|
if (cf->conf_file->file.fd == NGX_INVALID_FILE) {
|
|
|
|
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
|
|
|
|
"unexpected end of parameter, "
|
|
|
|
"expecting \";\"");
|
|
|
|
return NGX_ERROR;
|
|
|
|
}
|
|
|
|
|
2007-02-20 23:47:54 +08:00
|
|
|
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
|
|
|
|
"unexpected end of file, "
|
|
|
|
"expecting \";\" or \"}\"");
|
2005-02-09 22:31:07 +08:00
|
|
|
return NGX_ERROR;
|
|
|
|
}
|
|
|
|
|
2002-12-26 15:24:21 +08:00
|
|
|
return NGX_CONF_FILE_DONE;
|
2002-12-23 14:29:22 +08:00
|
|
|
}
|
|
|
|
|
2008-08-27 05:10:20 +08:00
|
|
|
len = b->pos - start;
|
|
|
|
|
2008-09-01 21:59:11 +08:00
|
|
|
if (len == NGX_CONF_BUFFER) {
|
2008-08-27 05:10:20 +08:00
|
|
|
cf->conf_file->line = start_line;
|
|
|
|
|
2008-08-27 20:19:07 +08:00
|
|
|
if (d_quoted) {
|
|
|
|
ch = '"';
|
|
|
|
|
|
|
|
} else if (s_quoted) {
|
|
|
|
ch = '\'';
|
|
|
|
|
|
|
|
} else {
|
|
|
|
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
|
|
|
|
"too long parameter \"%*s...\" started",
|
|
|
|
10, start);
|
|
|
|
return NGX_ERROR;
|
|
|
|
}
|
|
|
|
|
2008-08-27 05:10:20 +08:00
|
|
|
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
|
2008-08-27 20:19:07 +08:00
|
|
|
"too long parameter, probably "
|
|
|
|
"missing terminating \"%c\" character", ch);
|
2008-08-27 05:10:20 +08:00
|
|
|
return NGX_ERROR;
|
2002-12-19 15:08:55 +08:00
|
|
|
}
|
|
|
|
|
2008-08-27 05:10:20 +08:00
|
|
|
if (len) {
|
2011-04-12 16:02:46 +08:00
|
|
|
ngx_memmove(b->start, start, len);
|
2008-08-27 05:10:20 +08:00
|
|
|
}
|
|
|
|
|
2008-09-01 23:17:54 +08:00
|
|
|
size = (ssize_t) (file_size - cf->conf_file->file.offset);
|
2008-09-01 21:59:11 +08:00
|
|
|
|
|
|
|
if (size > b->end - (b->start + len)) {
|
|
|
|
size = b->end - (b->start + len);
|
|
|
|
}
|
|
|
|
|
|
|
|
n = ngx_read_file(&cf->conf_file->file, b->start + len, size,
|
2002-12-19 15:08:55 +08:00
|
|
|
cf->conf_file->file.offset);
|
2002-12-03 00:09:40 +08:00
|
|
|
|
2002-12-19 15:08:55 +08:00
|
|
|
if (n == NGX_ERROR) {
|
|
|
|
return NGX_ERROR;
|
|
|
|
}
|
2002-12-03 00:09:40 +08:00
|
|
|
|
2008-09-01 21:59:11 +08:00
|
|
|
if (n != size) {
|
|
|
|
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
|
|
|
|
ngx_read_file_n " returned "
|
|
|
|
"only %z bytes instead of %z",
|
|
|
|
n, size);
|
|
|
|
return NGX_ERROR;
|
|
|
|
}
|
|
|
|
|
2008-08-27 05:10:20 +08:00
|
|
|
b->pos = b->start + len;
|
2004-05-28 23:49:23 +08:00
|
|
|
b->last = b->pos + n;
|
2008-08-27 05:10:20 +08:00
|
|
|
start = b->start;
|
2002-12-19 15:08:55 +08:00
|
|
|
}
|
2002-12-03 00:09:40 +08:00
|
|
|
|
2004-05-28 23:49:23 +08:00
|
|
|
ch = *b->pos++;
|
2002-12-23 14:29:22 +08:00
|
|
|
|
2002-12-19 15:08:55 +08:00
|
|
|
if (ch == LF) {
|
|
|
|
cf->conf_file->line++;
|
2002-12-26 15:24:21 +08:00
|
|
|
|
|
|
|
if (sharp_comment) {
|
|
|
|
sharp_comment = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (sharp_comment) {
|
|
|
|
continue;
|
2002-12-19 15:08:55 +08:00
|
|
|
}
|
2002-12-03 00:09:40 +08:00
|
|
|
|
2002-12-24 02:22:18 +08:00
|
|
|
if (quoted) {
|
|
|
|
quoted = 0;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2002-12-23 14:29:22 +08:00
|
|
|
if (need_space) {
|
|
|
|
if (ch == ' ' || ch == '\t' || ch == CR || ch == LF) {
|
|
|
|
last_space = 1;
|
|
|
|
need_space = 0;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2004-11-11 22:07:14 +08:00
|
|
|
if (ch == ';') {
|
2002-12-23 14:29:22 +08:00
|
|
|
return NGX_OK;
|
|
|
|
}
|
|
|
|
|
2004-11-11 22:07:14 +08:00
|
|
|
if (ch == '{') {
|
|
|
|
return NGX_CONF_BLOCK_START;
|
|
|
|
}
|
|
|
|
|
2005-11-26 18:11:11 +08:00
|
|
|
if (ch == ')') {
|
|
|
|
last_space = 1;
|
|
|
|
need_space = 0;
|
2003-11-11 01:17:31 +08:00
|
|
|
|
2005-11-26 18:11:11 +08:00
|
|
|
} else {
|
2007-02-20 23:47:54 +08:00
|
|
|
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
|
|
|
|
"unexpected \"%c\"", ch);
|
2005-11-26 18:11:11 +08:00
|
|
|
return NGX_ERROR;
|
|
|
|
}
|
2002-12-23 14:29:22 +08:00
|
|
|
}
|
|
|
|
|
2002-12-19 15:08:55 +08:00
|
|
|
if (last_space) {
|
|
|
|
if (ch == ' ' || ch == '\t' || ch == CR || ch == LF) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2004-05-28 23:49:23 +08:00
|
|
|
start = b->pos - 1;
|
2008-08-27 05:10:20 +08:00
|
|
|
start_line = cf->conf_file->line;
|
2002-12-03 00:09:40 +08:00
|
|
|
|
2002-12-23 14:29:22 +08:00
|
|
|
switch (ch) {
|
2002-12-03 00:09:40 +08:00
|
|
|
|
2002-12-24 02:22:18 +08:00
|
|
|
case ';':
|
|
|
|
case '{':
|
2002-12-26 15:24:21 +08:00
|
|
|
if (cf->args->nelts == 0) {
|
2007-02-20 23:47:54 +08:00
|
|
|
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
|
|
|
|
"unexpected \"%c\"", ch);
|
2002-12-26 15:24:21 +08:00
|
|
|
return NGX_ERROR;
|
|
|
|
}
|
|
|
|
|
2004-11-11 22:07:14 +08:00
|
|
|
if (ch == '{') {
|
|
|
|
return NGX_CONF_BLOCK_START;
|
|
|
|
}
|
|
|
|
|
2002-12-24 02:22:18 +08:00
|
|
|
return NGX_OK;
|
|
|
|
|
2002-12-26 15:24:21 +08:00
|
|
|
case '}':
|
2005-05-23 20:07:45 +08:00
|
|
|
if (cf->args->nelts != 0) {
|
2007-02-20 23:47:54 +08:00
|
|
|
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
|
|
|
|
"unexpected \"}\"");
|
2002-12-26 15:24:21 +08:00
|
|
|
return NGX_ERROR;
|
|
|
|
}
|
|
|
|
|
|
|
|
return NGX_CONF_BLOCK_DONE;
|
|
|
|
|
|
|
|
case '#':
|
|
|
|
sharp_comment = 1;
|
|
|
|
continue;
|
|
|
|
|
2002-12-23 14:29:22 +08:00
|
|
|
case '\\':
|
|
|
|
quoted = 1;
|
|
|
|
last_space = 0;
|
2002-12-03 00:09:40 +08:00
|
|
|
continue;
|
|
|
|
|
2002-12-23 14:29:22 +08:00
|
|
|
case '"':
|
|
|
|
start++;
|
|
|
|
d_quoted = 1;
|
|
|
|
last_space = 0;
|
|
|
|
continue;
|
2002-12-03 00:09:40 +08:00
|
|
|
|
2002-12-23 14:29:22 +08:00
|
|
|
case '\'':
|
|
|
|
start++;
|
|
|
|
s_quoted = 1;
|
|
|
|
last_space = 0;
|
2002-12-03 00:09:40 +08:00
|
|
|
continue;
|
2002-12-23 14:29:22 +08:00
|
|
|
|
|
|
|
default:
|
|
|
|
last_space = 0;
|
2002-12-03 00:09:40 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
nginx-0.1.29-RELEASE import
*) Feature: the ngx_http_ssi_module supports "include virtual" command.
*) Feature: the ngx_http_ssi_module supports the condition command like
'if expr="$NAME"' and "else" and "endif" commands. Only one nested
level is supported.
*) Feature: the ngx_http_ssi_module supports the DATE_LOCAL and
DATE_GMT variables and "config timefmt" command.
*) Feature: the "ssi_ignore_recycled_buffers" directive.
*) Bugfix: the "echo" command did not show the default value for the
empty QUERY_STRING variable.
*) Change: the ngx_http_proxy_module was rewritten.
*) Feature: the "proxy_redirect", "proxy_pass_request_headers",
"proxy_pass_request_body", and "proxy_method" directives.
*) Feature: the "proxy_set_header" directive. The "proxy_x_var" was
canceled and must be replaced with the proxy_set_header directive.
*) Change: the "proxy_preserve_host" is canceled and must be replaced
with the "proxy_set_header Host $host" and the "proxy_redirect off"
directives, the "proxy_set_header Host $host:$proxy_port" directive
and the appropriate proxy_redirect directives.
*) Change: the "proxy_set_x_real_ip" is canceled and must be replaced
with the "proxy_set_header X-Real-IP $remote_addr" directive.
*) Change: the "proxy_add_x_forwarded_for" is canceled and must be
replaced with
the "proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for"
directive.
*) Change: the "proxy_set_x_url" is canceled and must be replaced with
the "proxy_set_header X-URL http://$host:$server_port$request_uri"
directive.
*) Feature: the "fastcgi_param" directive.
*) Change: the "fastcgi_root", "fastcgi_set_var" and "fastcgi_params"
directive are canceled and must be replaced with the fastcgi_param
directives.
*) Feature: the "index" directive can use the variables.
*) Feature: the "index" directive can be used at http and server levels.
*) Change: the last index only in the "index" directive can be absolute.
*) Feature: the "rewrite" directive can use the variables.
*) Feature: the "internal" directive.
*) Feature: the CONTENT_LENGTH, CONTENT_TYPE, REMOTE_PORT, SERVER_ADDR,
SERVER_PORT, SERVER_PROTOCOL, DOCUMENT_ROOT, SERVER_NAME,
REQUEST_METHOD, REQUEST_URI, and REMOTE_USER variables.
*) Change: nginx now passes the invalid lines in a client request
headers or a backend response header.
*) Bugfix: if the backend did not transfer response for a long time and
the "send_timeout" was less than "proxy_read_timeout", then nginx
returned the 408 response.
*) Bugfix: the segmentation fault was occurred if the backend sent an
invalid line in response header; the bug had appeared in 0.1.26.
*) Bugfix: the segmentation fault may occurred in FastCGI fault
tolerance configuration.
*) Bugfix: the "expires" directive did not remove the previous
"Expires" and "Cache-Control" headers.
*) Bugfix: nginx did not take into account trailing dot in "Host"
header line.
*) Bugfix: the ngx_http_auth_module did not work under Linux.
*) Bugfix: the rewrite directive worked incorrectly, if the arguments
were in a request.
*) Bugfix: nginx could not be built on MacOS X.
2005-05-12 22:58:06 +08:00
|
|
|
if (ch == '{' && variable) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
variable = 0;
|
|
|
|
|
2002-12-23 14:29:22 +08:00
|
|
|
if (ch == '\\') {
|
|
|
|
quoted = 1;
|
|
|
|
continue;
|
|
|
|
}
|
2002-12-03 00:09:40 +08:00
|
|
|
|
nginx-0.1.29-RELEASE import
*) Feature: the ngx_http_ssi_module supports "include virtual" command.
*) Feature: the ngx_http_ssi_module supports the condition command like
'if expr="$NAME"' and "else" and "endif" commands. Only one nested
level is supported.
*) Feature: the ngx_http_ssi_module supports the DATE_LOCAL and
DATE_GMT variables and "config timefmt" command.
*) Feature: the "ssi_ignore_recycled_buffers" directive.
*) Bugfix: the "echo" command did not show the default value for the
empty QUERY_STRING variable.
*) Change: the ngx_http_proxy_module was rewritten.
*) Feature: the "proxy_redirect", "proxy_pass_request_headers",
"proxy_pass_request_body", and "proxy_method" directives.
*) Feature: the "proxy_set_header" directive. The "proxy_x_var" was
canceled and must be replaced with the proxy_set_header directive.
*) Change: the "proxy_preserve_host" is canceled and must be replaced
with the "proxy_set_header Host $host" and the "proxy_redirect off"
directives, the "proxy_set_header Host $host:$proxy_port" directive
and the appropriate proxy_redirect directives.
*) Change: the "proxy_set_x_real_ip" is canceled and must be replaced
with the "proxy_set_header X-Real-IP $remote_addr" directive.
*) Change: the "proxy_add_x_forwarded_for" is canceled and must be
replaced with
the "proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for"
directive.
*) Change: the "proxy_set_x_url" is canceled and must be replaced with
the "proxy_set_header X-URL http://$host:$server_port$request_uri"
directive.
*) Feature: the "fastcgi_param" directive.
*) Change: the "fastcgi_root", "fastcgi_set_var" and "fastcgi_params"
directive are canceled and must be replaced with the fastcgi_param
directives.
*) Feature: the "index" directive can use the variables.
*) Feature: the "index" directive can be used at http and server levels.
*) Change: the last index only in the "index" directive can be absolute.
*) Feature: the "rewrite" directive can use the variables.
*) Feature: the "internal" directive.
*) Feature: the CONTENT_LENGTH, CONTENT_TYPE, REMOTE_PORT, SERVER_ADDR,
SERVER_PORT, SERVER_PROTOCOL, DOCUMENT_ROOT, SERVER_NAME,
REQUEST_METHOD, REQUEST_URI, and REMOTE_USER variables.
*) Change: nginx now passes the invalid lines in a client request
headers or a backend response header.
*) Bugfix: if the backend did not transfer response for a long time and
the "send_timeout" was less than "proxy_read_timeout", then nginx
returned the 408 response.
*) Bugfix: the segmentation fault was occurred if the backend sent an
invalid line in response header; the bug had appeared in 0.1.26.
*) Bugfix: the segmentation fault may occurred in FastCGI fault
tolerance configuration.
*) Bugfix: the "expires" directive did not remove the previous
"Expires" and "Cache-Control" headers.
*) Bugfix: nginx did not take into account trailing dot in "Host"
header line.
*) Bugfix: the ngx_http_auth_module did not work under Linux.
*) Bugfix: the rewrite directive worked incorrectly, if the arguments
were in a request.
*) Bugfix: nginx could not be built on MacOS X.
2005-05-12 22:58:06 +08:00
|
|
|
if (ch == '$') {
|
|
|
|
variable = 1;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2002-12-23 14:29:22 +08:00
|
|
|
if (d_quoted) {
|
|
|
|
if (ch == '"') {
|
|
|
|
d_quoted = 0;
|
|
|
|
need_space = 1;
|
|
|
|
found = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
} else if (s_quoted) {
|
|
|
|
if (ch == '\'') {
|
|
|
|
s_quoted = 0;
|
|
|
|
need_space = 1;
|
|
|
|
found = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
} else if (ch == ' ' || ch == '\t' || ch == CR || ch == LF
|
2010-06-24 00:34:54 +08:00
|
|
|
|| ch == ';' || ch == '{')
|
|
|
|
{
|
2002-12-23 14:29:22 +08:00
|
|
|
last_space = 1;
|
|
|
|
found = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (found) {
|
2005-03-19 20:38:37 +08:00
|
|
|
word = ngx_array_push(cf->args);
|
|
|
|
if (word == NULL) {
|
2004-05-28 23:49:23 +08:00
|
|
|
return NGX_ERROR;
|
|
|
|
}
|
|
|
|
|
2008-06-17 23:00:30 +08:00
|
|
|
word->data = ngx_pnalloc(cf->pool, b->pos - start + 1);
|
2005-03-19 20:38:37 +08:00
|
|
|
if (word->data == NULL) {
|
2004-05-28 23:49:23 +08:00
|
|
|
return NGX_ERROR;
|
|
|
|
}
|
2002-12-03 00:09:40 +08:00
|
|
|
|
2002-12-24 02:22:18 +08:00
|
|
|
for (dst = word->data, src = start, len = 0;
|
2004-05-28 23:49:23 +08:00
|
|
|
src < b->pos - 1;
|
2002-12-24 02:22:18 +08:00
|
|
|
len++)
|
2002-12-23 14:29:22 +08:00
|
|
|
{
|
|
|
|
if (*src == '\\') {
|
2003-11-26 04:44:56 +08:00
|
|
|
switch (src[1]) {
|
|
|
|
case '"':
|
|
|
|
case '\'':
|
|
|
|
case '\\':
|
|
|
|
src++;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 't':
|
|
|
|
*dst++ = '\t';
|
|
|
|
src += 2;
|
|
|
|
continue;
|
|
|
|
|
|
|
|
case 'r':
|
|
|
|
*dst++ = '\r';
|
|
|
|
src += 2;
|
|
|
|
continue;
|
|
|
|
|
|
|
|
case 'n':
|
|
|
|
*dst++ = '\n';
|
|
|
|
src += 2;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2002-12-23 14:29:22 +08:00
|
|
|
}
|
2002-12-03 00:09:40 +08:00
|
|
|
*dst++ = *src++;
|
|
|
|
}
|
|
|
|
*dst = '\0';
|
2002-12-24 02:22:18 +08:00
|
|
|
word->len = len;
|
2002-12-03 00:09:40 +08:00
|
|
|
|
2004-11-11 22:07:14 +08:00
|
|
|
if (ch == ';') {
|
2002-12-23 14:29:22 +08:00
|
|
|
return NGX_OK;
|
2002-12-03 00:09:40 +08:00
|
|
|
}
|
|
|
|
|
2004-11-11 22:07:14 +08:00
|
|
|
if (ch == '{') {
|
|
|
|
return NGX_CONF_BLOCK_START;
|
|
|
|
}
|
|
|
|
|
2002-12-23 14:29:22 +08:00
|
|
|
found = 0;
|
2002-12-03 00:09:40 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-08-28 21:31:01 +08:00
|
|
|
char *
|
2005-03-23 00:02:46 +08:00
|
|
|
ngx_conf_include(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
2004-05-18 23:29:08 +08:00
|
|
|
{
|
2006-10-02 16:46:45 +08:00
|
|
|
char *rv;
|
|
|
|
ngx_int_t n;
|
2008-03-04 01:12:05 +08:00
|
|
|
ngx_str_t *value, file, name;
|
2006-10-02 16:46:45 +08:00
|
|
|
ngx_glob_t gl;
|
2004-05-18 23:29:08 +08:00
|
|
|
|
|
|
|
value = cf->args->elts;
|
2004-09-28 00:03:21 +08:00
|
|
|
file = value[1];
|
2004-05-18 23:29:08 +08:00
|
|
|
|
2006-10-02 16:46:45 +08:00
|
|
|
ngx_log_debug1(NGX_LOG_DEBUG_CORE, cf->log, 0, "include %s", file.data);
|
|
|
|
|
2013-08-21 01:11:19 +08:00
|
|
|
if (ngx_conf_full_name(cf->cycle, &file, 1) != NGX_OK) {
|
2004-05-18 23:29:08 +08:00
|
|
|
return NGX_CONF_ERROR;
|
|
|
|
}
|
|
|
|
|
2008-04-29 17:28:42 +08:00
|
|
|
if (strpbrk((char *) file.data, "*?[") == NULL) {
|
|
|
|
|
|
|
|
ngx_log_debug1(NGX_LOG_DEBUG_CORE, cf->log, 0, "include %s", file.data);
|
|
|
|
|
|
|
|
return ngx_conf_parse(cf, &file);
|
|
|
|
}
|
|
|
|
|
2006-10-02 16:46:45 +08:00
|
|
|
ngx_memzero(&gl, sizeof(ngx_glob_t));
|
|
|
|
|
|
|
|
gl.pattern = file.data;
|
|
|
|
gl.log = cf->log;
|
2008-04-29 17:28:42 +08:00
|
|
|
gl.test = 1;
|
2006-10-02 16:46:45 +08:00
|
|
|
|
|
|
|
if (ngx_open_glob(&gl) != NGX_OK) {
|
|
|
|
ngx_conf_log_error(NGX_LOG_EMERG, cf, ngx_errno,
|
|
|
|
ngx_open_glob_n " \"%s\" failed", file.data);
|
|
|
|
return NGX_CONF_ERROR;
|
|
|
|
}
|
|
|
|
|
|
|
|
rv = NGX_CONF_OK;
|
|
|
|
|
|
|
|
for ( ;; ) {
|
2008-03-04 01:12:05 +08:00
|
|
|
n = ngx_read_glob(&gl, &name);
|
2006-10-02 16:46:45 +08:00
|
|
|
|
|
|
|
if (n != NGX_OK) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2008-03-04 01:12:05 +08:00
|
|
|
file.len = name.len++;
|
|
|
|
file.data = ngx_pstrdup(cf->pool, &name);
|
|
|
|
|
2006-10-02 16:46:45 +08:00
|
|
|
ngx_log_debug1(NGX_LOG_DEBUG_CORE, cf->log, 0, "include %s", file.data);
|
|
|
|
|
|
|
|
rv = ngx_conf_parse(cf, &file);
|
|
|
|
|
|
|
|
if (rv != NGX_CONF_OK) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ngx_close_glob(&gl);
|
2004-05-18 23:29:08 +08:00
|
|
|
|
2006-10-02 16:46:45 +08:00
|
|
|
return rv;
|
2004-05-18 23:29:08 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-08-21 01:11:19 +08:00
|
|
|
ngx_int_t
|
|
|
|
ngx_conf_full_name(ngx_cycle_t *cycle, ngx_str_t *name, ngx_uint_t conf_prefix)
|
|
|
|
{
|
2013-08-21 01:33:43 +08:00
|
|
|
ngx_str_t *prefix;
|
|
|
|
|
|
|
|
prefix = conf_prefix ? &cycle->conf_prefix : &cycle->prefix;
|
|
|
|
|
|
|
|
return ngx_get_full_name(cycle->pool, prefix, name);
|
2013-08-21 01:11:19 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-03-23 00:02:46 +08:00
|
|
|
ngx_open_file_t *
|
|
|
|
ngx_conf_open_file(ngx_cycle_t *cycle, ngx_str_t *name)
|
2003-07-21 05:15:59 +08:00
|
|
|
{
|
2004-09-28 00:03:21 +08:00
|
|
|
ngx_str_t full;
|
2004-03-16 15:10:12 +08:00
|
|
|
ngx_uint_t i;
|
2004-09-03 23:50:30 +08:00
|
|
|
ngx_list_part_t *part;
|
2003-07-21 05:15:59 +08:00
|
|
|
ngx_open_file_t *file;
|
|
|
|
|
2004-10-04 04:02:06 +08:00
|
|
|
#if (NGX_SUPPRESS_WARN)
|
2010-05-14 17:56:37 +08:00
|
|
|
ngx_str_null(&full);
|
2004-10-04 04:02:06 +08:00
|
|
|
#endif
|
|
|
|
|
2009-04-30 21:53:42 +08:00
|
|
|
if (name->len) {
|
2004-09-28 00:03:21 +08:00
|
|
|
full = *name;
|
|
|
|
|
2013-08-21 01:11:19 +08:00
|
|
|
if (ngx_conf_full_name(cycle, &full, 0) != NGX_OK) {
|
2004-09-28 00:03:21 +08:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2004-09-03 23:50:30 +08:00
|
|
|
part = &cycle->open_files.part;
|
|
|
|
file = part->elts;
|
|
|
|
|
|
|
|
for (i = 0; /* void */ ; i++) {
|
|
|
|
|
|
|
|
if (i >= part->nelts) {
|
|
|
|
if (part->next == NULL) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
part = part->next;
|
|
|
|
file = part->elts;
|
|
|
|
i = 0;
|
|
|
|
}
|
|
|
|
|
2004-09-28 00:03:21 +08:00
|
|
|
if (full.len != file[i].name.len) {
|
2003-07-21 05:15:59 +08:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2004-09-28 00:03:21 +08:00
|
|
|
if (ngx_strcmp(full.data, file[i].name.data) == 0) {
|
2003-07-21 05:15:59 +08:00
|
|
|
return &file[i];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-03-19 20:38:37 +08:00
|
|
|
file = ngx_list_push(&cycle->open_files);
|
|
|
|
if (file == NULL) {
|
2004-05-28 23:49:23 +08:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2009-04-30 21:53:42 +08:00
|
|
|
if (name->len) {
|
2004-10-01 03:44:38 +08:00
|
|
|
file->fd = NGX_INVALID_FILE;
|
2004-09-28 00:03:21 +08:00
|
|
|
file->name = full;
|
|
|
|
|
2004-09-06 03:54:02 +08:00
|
|
|
} else {
|
2009-04-23 19:13:12 +08:00
|
|
|
file->fd = ngx_stderr;
|
2009-04-30 21:53:42 +08:00
|
|
|
file->name = *name;
|
2003-07-21 05:15:59 +08:00
|
|
|
}
|
|
|
|
|
2012-12-23 23:36:52 +08:00
|
|
|
file->flush = NULL;
|
2013-01-08 22:01:57 +08:00
|
|
|
file->data = NULL;
|
2005-10-27 23:46:13 +08:00
|
|
|
|
2003-07-21 05:15:59 +08:00
|
|
|
return file;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-10-27 23:46:13 +08:00
|
|
|
static void
|
|
|
|
ngx_conf_flush_files(ngx_cycle_t *cycle)
|
|
|
|
{
|
|
|
|
ngx_uint_t i;
|
|
|
|
ngx_list_part_t *part;
|
|
|
|
ngx_open_file_t *file;
|
|
|
|
|
|
|
|
ngx_log_debug0(NGX_LOG_DEBUG_CORE, cycle->log, 0, "flush files");
|
|
|
|
|
|
|
|
part = &cycle->open_files.part;
|
|
|
|
file = part->elts;
|
|
|
|
|
|
|
|
for (i = 0; /* void */ ; i++) {
|
|
|
|
|
|
|
|
if (i >= part->nelts) {
|
|
|
|
if (part->next == NULL) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
part = part->next;
|
|
|
|
file = part->elts;
|
|
|
|
i = 0;
|
|
|
|
}
|
|
|
|
|
2012-12-23 23:36:52 +08:00
|
|
|
if (file[i].flush) {
|
|
|
|
file[i].flush(&file[i], cycle->log);
|
2008-11-12 00:17:45 +08:00
|
|
|
}
|
2005-10-27 23:46:13 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-03-23 00:02:46 +08:00
|
|
|
void ngx_cdecl
|
|
|
|
ngx_conf_log_error(ngx_uint_t level, ngx_conf_t *cf, ngx_err_t err,
|
2010-02-12 17:45:05 +08:00
|
|
|
const char *fmt, ...)
|
2003-07-18 22:44:05 +08:00
|
|
|
{
|
2008-11-25 21:00:53 +08:00
|
|
|
u_char errstr[NGX_MAX_CONF_ERRSTR], *p, *last;
|
2003-07-18 22:44:05 +08:00
|
|
|
va_list args;
|
|
|
|
|
2004-11-11 22:07:14 +08:00
|
|
|
last = errstr + NGX_MAX_CONF_ERRSTR;
|
|
|
|
|
2003-07-18 22:44:05 +08:00
|
|
|
va_start(args, fmt);
|
2009-04-27 21:06:20 +08:00
|
|
|
p = ngx_vslprintf(errstr, last, fmt, args);
|
2003-07-18 22:44:05 +08:00
|
|
|
va_end(args);
|
|
|
|
|
|
|
|
if (err) {
|
2009-04-27 21:17:33 +08:00
|
|
|
p = ngx_log_errno(p, last, err);
|
2003-07-18 22:44:05 +08:00
|
|
|
}
|
|
|
|
|
2005-12-27 01:07:48 +08:00
|
|
|
if (cf->conf_file == NULL) {
|
2008-11-25 21:00:53 +08:00
|
|
|
ngx_log_error(level, cf->log, 0, "%*s", p - errstr, errstr);
|
2005-12-27 01:07:48 +08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2009-04-29 04:06:03 +08:00
|
|
|
if (cf->conf_file->file.fd == NGX_INVALID_FILE) {
|
|
|
|
ngx_log_error(level, cf->log, 0, "%*s in command line",
|
|
|
|
p - errstr, errstr);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2008-11-25 21:00:53 +08:00
|
|
|
ngx_log_error(level, cf->log, 0, "%*s in %s:%ui",
|
|
|
|
p - errstr, errstr,
|
|
|
|
cf->conf_file->file.name.data, cf->conf_file->line);
|
2003-07-18 22:44:05 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-03-23 00:02:46 +08:00
|
|
|
char *
|
|
|
|
ngx_conf_set_flag_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
2003-03-04 14:33:48 +08:00
|
|
|
{
|
2003-05-30 22:27:59 +08:00
|
|
|
char *p = conf;
|
|
|
|
|
2004-09-23 00:18:21 +08:00
|
|
|
ngx_str_t *value;
|
|
|
|
ngx_flag_t *fp;
|
|
|
|
ngx_conf_post_t *post;
|
2003-03-04 14:33:48 +08:00
|
|
|
|
2004-09-23 00:18:21 +08:00
|
|
|
fp = (ngx_flag_t *) (p + cmd->offset);
|
2003-10-23 14:13:16 +08:00
|
|
|
|
2004-09-23 00:18:21 +08:00
|
|
|
if (*fp != NGX_CONF_UNSET) {
|
2003-05-20 23:37:55 +08:00
|
|
|
return "is duplicate";
|
|
|
|
}
|
|
|
|
|
2004-04-14 13:57:36 +08:00
|
|
|
value = cf->args->elts;
|
2003-03-04 14:33:48 +08:00
|
|
|
|
2007-02-15 02:51:19 +08:00
|
|
|
if (ngx_strcasecmp(value[1].data, (u_char *) "on") == 0) {
|
2004-09-23 00:18:21 +08:00
|
|
|
*fp = 1;
|
2003-03-04 14:33:48 +08:00
|
|
|
|
2007-02-15 02:51:19 +08:00
|
|
|
} else if (ngx_strcasecmp(value[1].data, (u_char *) "off") == 0) {
|
2004-09-23 00:18:21 +08:00
|
|
|
*fp = 0;
|
2003-03-04 14:33:48 +08:00
|
|
|
|
|
|
|
} else {
|
2003-07-21 05:15:59 +08:00
|
|
|
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
|
|
|
|
"invalid value \"%s\" in \"%s\" directive, "
|
|
|
|
"it must be \"on\" or \"off\"",
|
|
|
|
value[1].data, cmd->name.data);
|
|
|
|
return NGX_CONF_ERROR;
|
2003-03-04 14:33:48 +08:00
|
|
|
}
|
|
|
|
|
2004-09-23 00:18:21 +08:00
|
|
|
if (cmd->post) {
|
|
|
|
post = cmd->post;
|
|
|
|
return post->post_handler(cf, post, fp);
|
|
|
|
}
|
2003-03-04 14:33:48 +08:00
|
|
|
|
|
|
|
return NGX_CONF_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-03-23 00:02:46 +08:00
|
|
|
char *
|
|
|
|
ngx_conf_set_str_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
2003-01-09 13:36:00 +08:00
|
|
|
{
|
2003-05-30 22:27:59 +08:00
|
|
|
char *p = conf;
|
|
|
|
|
2004-08-31 23:32:52 +08:00
|
|
|
ngx_str_t *field, *value;
|
|
|
|
ngx_conf_post_t *post;
|
2003-01-09 13:36:00 +08:00
|
|
|
|
2003-05-30 22:27:59 +08:00
|
|
|
field = (ngx_str_t *) (p + cmd->offset);
|
2003-05-20 23:37:55 +08:00
|
|
|
|
2003-05-27 20:18:54 +08:00
|
|
|
if (field->data) {
|
2003-05-20 23:37:55 +08:00
|
|
|
return "is duplicate";
|
|
|
|
}
|
|
|
|
|
2004-04-14 13:57:36 +08:00
|
|
|
value = cf->args->elts;
|
2003-01-09 13:36:00 +08:00
|
|
|
|
2003-10-23 00:38:26 +08:00
|
|
|
*field = value[1];
|
2003-01-09 13:36:00 +08:00
|
|
|
|
2004-08-31 23:32:52 +08:00
|
|
|
if (cmd->post) {
|
|
|
|
post = cmd->post;
|
|
|
|
return post->post_handler(cf, post, field);
|
|
|
|
}
|
|
|
|
|
2003-01-09 13:36:00 +08:00
|
|
|
return NGX_CONF_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
nginx-0.1.29-RELEASE import
*) Feature: the ngx_http_ssi_module supports "include virtual" command.
*) Feature: the ngx_http_ssi_module supports the condition command like
'if expr="$NAME"' and "else" and "endif" commands. Only one nested
level is supported.
*) Feature: the ngx_http_ssi_module supports the DATE_LOCAL and
DATE_GMT variables and "config timefmt" command.
*) Feature: the "ssi_ignore_recycled_buffers" directive.
*) Bugfix: the "echo" command did not show the default value for the
empty QUERY_STRING variable.
*) Change: the ngx_http_proxy_module was rewritten.
*) Feature: the "proxy_redirect", "proxy_pass_request_headers",
"proxy_pass_request_body", and "proxy_method" directives.
*) Feature: the "proxy_set_header" directive. The "proxy_x_var" was
canceled and must be replaced with the proxy_set_header directive.
*) Change: the "proxy_preserve_host" is canceled and must be replaced
with the "proxy_set_header Host $host" and the "proxy_redirect off"
directives, the "proxy_set_header Host $host:$proxy_port" directive
and the appropriate proxy_redirect directives.
*) Change: the "proxy_set_x_real_ip" is canceled and must be replaced
with the "proxy_set_header X-Real-IP $remote_addr" directive.
*) Change: the "proxy_add_x_forwarded_for" is canceled and must be
replaced with
the "proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for"
directive.
*) Change: the "proxy_set_x_url" is canceled and must be replaced with
the "proxy_set_header X-URL http://$host:$server_port$request_uri"
directive.
*) Feature: the "fastcgi_param" directive.
*) Change: the "fastcgi_root", "fastcgi_set_var" and "fastcgi_params"
directive are canceled and must be replaced with the fastcgi_param
directives.
*) Feature: the "index" directive can use the variables.
*) Feature: the "index" directive can be used at http and server levels.
*) Change: the last index only in the "index" directive can be absolute.
*) Feature: the "rewrite" directive can use the variables.
*) Feature: the "internal" directive.
*) Feature: the CONTENT_LENGTH, CONTENT_TYPE, REMOTE_PORT, SERVER_ADDR,
SERVER_PORT, SERVER_PROTOCOL, DOCUMENT_ROOT, SERVER_NAME,
REQUEST_METHOD, REQUEST_URI, and REMOTE_USER variables.
*) Change: nginx now passes the invalid lines in a client request
headers or a backend response header.
*) Bugfix: if the backend did not transfer response for a long time and
the "send_timeout" was less than "proxy_read_timeout", then nginx
returned the 408 response.
*) Bugfix: the segmentation fault was occurred if the backend sent an
invalid line in response header; the bug had appeared in 0.1.26.
*) Bugfix: the segmentation fault may occurred in FastCGI fault
tolerance configuration.
*) Bugfix: the "expires" directive did not remove the previous
"Expires" and "Cache-Control" headers.
*) Bugfix: nginx did not take into account trailing dot in "Host"
header line.
*) Bugfix: the ngx_http_auth_module did not work under Linux.
*) Bugfix: the rewrite directive worked incorrectly, if the arguments
were in a request.
*) Bugfix: nginx could not be built on MacOS X.
2005-05-12 22:58:06 +08:00
|
|
|
char *
|
2006-05-11 22:43:47 +08:00
|
|
|
ngx_conf_set_str_array_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
|
|
|
{
|
|
|
|
char *p = conf;
|
|
|
|
|
|
|
|
ngx_str_t *value, *s;
|
|
|
|
ngx_array_t **a;
|
|
|
|
ngx_conf_post_t *post;
|
|
|
|
|
|
|
|
a = (ngx_array_t **) (p + cmd->offset);
|
|
|
|
|
2007-12-10 02:03:20 +08:00
|
|
|
if (*a == NGX_CONF_UNSET_PTR) {
|
2006-05-11 22:43:47 +08:00
|
|
|
*a = ngx_array_create(cf->pool, 4, sizeof(ngx_str_t));
|
|
|
|
if (*a == NULL) {
|
|
|
|
return NGX_CONF_ERROR;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
s = ngx_array_push(*a);
|
|
|
|
if (s == NULL) {
|
|
|
|
return NGX_CONF_ERROR;
|
|
|
|
}
|
|
|
|
|
|
|
|
value = cf->args->elts;
|
|
|
|
|
|
|
|
*s = value[1];
|
|
|
|
|
|
|
|
if (cmd->post) {
|
|
|
|
post = cmd->post;
|
|
|
|
return post->post_handler(cf, post, s);
|
|
|
|
}
|
|
|
|
|
|
|
|
return NGX_CONF_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
char *
|
|
|
|
ngx_conf_set_keyval_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
nginx-0.1.29-RELEASE import
*) Feature: the ngx_http_ssi_module supports "include virtual" command.
*) Feature: the ngx_http_ssi_module supports the condition command like
'if expr="$NAME"' and "else" and "endif" commands. Only one nested
level is supported.
*) Feature: the ngx_http_ssi_module supports the DATE_LOCAL and
DATE_GMT variables and "config timefmt" command.
*) Feature: the "ssi_ignore_recycled_buffers" directive.
*) Bugfix: the "echo" command did not show the default value for the
empty QUERY_STRING variable.
*) Change: the ngx_http_proxy_module was rewritten.
*) Feature: the "proxy_redirect", "proxy_pass_request_headers",
"proxy_pass_request_body", and "proxy_method" directives.
*) Feature: the "proxy_set_header" directive. The "proxy_x_var" was
canceled and must be replaced with the proxy_set_header directive.
*) Change: the "proxy_preserve_host" is canceled and must be replaced
with the "proxy_set_header Host $host" and the "proxy_redirect off"
directives, the "proxy_set_header Host $host:$proxy_port" directive
and the appropriate proxy_redirect directives.
*) Change: the "proxy_set_x_real_ip" is canceled and must be replaced
with the "proxy_set_header X-Real-IP $remote_addr" directive.
*) Change: the "proxy_add_x_forwarded_for" is canceled and must be
replaced with
the "proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for"
directive.
*) Change: the "proxy_set_x_url" is canceled and must be replaced with
the "proxy_set_header X-URL http://$host:$server_port$request_uri"
directive.
*) Feature: the "fastcgi_param" directive.
*) Change: the "fastcgi_root", "fastcgi_set_var" and "fastcgi_params"
directive are canceled and must be replaced with the fastcgi_param
directives.
*) Feature: the "index" directive can use the variables.
*) Feature: the "index" directive can be used at http and server levels.
*) Change: the last index only in the "index" directive can be absolute.
*) Feature: the "rewrite" directive can use the variables.
*) Feature: the "internal" directive.
*) Feature: the CONTENT_LENGTH, CONTENT_TYPE, REMOTE_PORT, SERVER_ADDR,
SERVER_PORT, SERVER_PROTOCOL, DOCUMENT_ROOT, SERVER_NAME,
REQUEST_METHOD, REQUEST_URI, and REMOTE_USER variables.
*) Change: nginx now passes the invalid lines in a client request
headers or a backend response header.
*) Bugfix: if the backend did not transfer response for a long time and
the "send_timeout" was less than "proxy_read_timeout", then nginx
returned the 408 response.
*) Bugfix: the segmentation fault was occurred if the backend sent an
invalid line in response header; the bug had appeared in 0.1.26.
*) Bugfix: the segmentation fault may occurred in FastCGI fault
tolerance configuration.
*) Bugfix: the "expires" directive did not remove the previous
"Expires" and "Cache-Control" headers.
*) Bugfix: nginx did not take into account trailing dot in "Host"
header line.
*) Bugfix: the ngx_http_auth_module did not work under Linux.
*) Bugfix: the rewrite directive worked incorrectly, if the arguments
were in a request.
*) Bugfix: nginx could not be built on MacOS X.
2005-05-12 22:58:06 +08:00
|
|
|
{
|
|
|
|
char *p = conf;
|
|
|
|
|
|
|
|
ngx_str_t *value;
|
|
|
|
ngx_array_t **a;
|
2006-05-11 22:43:47 +08:00
|
|
|
ngx_keyval_t *kv;
|
nginx-0.1.29-RELEASE import
*) Feature: the ngx_http_ssi_module supports "include virtual" command.
*) Feature: the ngx_http_ssi_module supports the condition command like
'if expr="$NAME"' and "else" and "endif" commands. Only one nested
level is supported.
*) Feature: the ngx_http_ssi_module supports the DATE_LOCAL and
DATE_GMT variables and "config timefmt" command.
*) Feature: the "ssi_ignore_recycled_buffers" directive.
*) Bugfix: the "echo" command did not show the default value for the
empty QUERY_STRING variable.
*) Change: the ngx_http_proxy_module was rewritten.
*) Feature: the "proxy_redirect", "proxy_pass_request_headers",
"proxy_pass_request_body", and "proxy_method" directives.
*) Feature: the "proxy_set_header" directive. The "proxy_x_var" was
canceled and must be replaced with the proxy_set_header directive.
*) Change: the "proxy_preserve_host" is canceled and must be replaced
with the "proxy_set_header Host $host" and the "proxy_redirect off"
directives, the "proxy_set_header Host $host:$proxy_port" directive
and the appropriate proxy_redirect directives.
*) Change: the "proxy_set_x_real_ip" is canceled and must be replaced
with the "proxy_set_header X-Real-IP $remote_addr" directive.
*) Change: the "proxy_add_x_forwarded_for" is canceled and must be
replaced with
the "proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for"
directive.
*) Change: the "proxy_set_x_url" is canceled and must be replaced with
the "proxy_set_header X-URL http://$host:$server_port$request_uri"
directive.
*) Feature: the "fastcgi_param" directive.
*) Change: the "fastcgi_root", "fastcgi_set_var" and "fastcgi_params"
directive are canceled and must be replaced with the fastcgi_param
directives.
*) Feature: the "index" directive can use the variables.
*) Feature: the "index" directive can be used at http and server levels.
*) Change: the last index only in the "index" directive can be absolute.
*) Feature: the "rewrite" directive can use the variables.
*) Feature: the "internal" directive.
*) Feature: the CONTENT_LENGTH, CONTENT_TYPE, REMOTE_PORT, SERVER_ADDR,
SERVER_PORT, SERVER_PROTOCOL, DOCUMENT_ROOT, SERVER_NAME,
REQUEST_METHOD, REQUEST_URI, and REMOTE_USER variables.
*) Change: nginx now passes the invalid lines in a client request
headers or a backend response header.
*) Bugfix: if the backend did not transfer response for a long time and
the "send_timeout" was less than "proxy_read_timeout", then nginx
returned the 408 response.
*) Bugfix: the segmentation fault was occurred if the backend sent an
invalid line in response header; the bug had appeared in 0.1.26.
*) Bugfix: the segmentation fault may occurred in FastCGI fault
tolerance configuration.
*) Bugfix: the "expires" directive did not remove the previous
"Expires" and "Cache-Control" headers.
*) Bugfix: nginx did not take into account trailing dot in "Host"
header line.
*) Bugfix: the ngx_http_auth_module did not work under Linux.
*) Bugfix: the rewrite directive worked incorrectly, if the arguments
were in a request.
*) Bugfix: nginx could not be built on MacOS X.
2005-05-12 22:58:06 +08:00
|
|
|
ngx_conf_post_t *post;
|
|
|
|
|
|
|
|
a = (ngx_array_t **) (p + cmd->offset);
|
|
|
|
|
|
|
|
if (*a == NULL) {
|
2006-05-11 22:43:47 +08:00
|
|
|
*a = ngx_array_create(cf->pool, 4, sizeof(ngx_keyval_t));
|
nginx-0.1.29-RELEASE import
*) Feature: the ngx_http_ssi_module supports "include virtual" command.
*) Feature: the ngx_http_ssi_module supports the condition command like
'if expr="$NAME"' and "else" and "endif" commands. Only one nested
level is supported.
*) Feature: the ngx_http_ssi_module supports the DATE_LOCAL and
DATE_GMT variables and "config timefmt" command.
*) Feature: the "ssi_ignore_recycled_buffers" directive.
*) Bugfix: the "echo" command did not show the default value for the
empty QUERY_STRING variable.
*) Change: the ngx_http_proxy_module was rewritten.
*) Feature: the "proxy_redirect", "proxy_pass_request_headers",
"proxy_pass_request_body", and "proxy_method" directives.
*) Feature: the "proxy_set_header" directive. The "proxy_x_var" was
canceled and must be replaced with the proxy_set_header directive.
*) Change: the "proxy_preserve_host" is canceled and must be replaced
with the "proxy_set_header Host $host" and the "proxy_redirect off"
directives, the "proxy_set_header Host $host:$proxy_port" directive
and the appropriate proxy_redirect directives.
*) Change: the "proxy_set_x_real_ip" is canceled and must be replaced
with the "proxy_set_header X-Real-IP $remote_addr" directive.
*) Change: the "proxy_add_x_forwarded_for" is canceled and must be
replaced with
the "proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for"
directive.
*) Change: the "proxy_set_x_url" is canceled and must be replaced with
the "proxy_set_header X-URL http://$host:$server_port$request_uri"
directive.
*) Feature: the "fastcgi_param" directive.
*) Change: the "fastcgi_root", "fastcgi_set_var" and "fastcgi_params"
directive are canceled and must be replaced with the fastcgi_param
directives.
*) Feature: the "index" directive can use the variables.
*) Feature: the "index" directive can be used at http and server levels.
*) Change: the last index only in the "index" directive can be absolute.
*) Feature: the "rewrite" directive can use the variables.
*) Feature: the "internal" directive.
*) Feature: the CONTENT_LENGTH, CONTENT_TYPE, REMOTE_PORT, SERVER_ADDR,
SERVER_PORT, SERVER_PROTOCOL, DOCUMENT_ROOT, SERVER_NAME,
REQUEST_METHOD, REQUEST_URI, and REMOTE_USER variables.
*) Change: nginx now passes the invalid lines in a client request
headers or a backend response header.
*) Bugfix: if the backend did not transfer response for a long time and
the "send_timeout" was less than "proxy_read_timeout", then nginx
returned the 408 response.
*) Bugfix: the segmentation fault was occurred if the backend sent an
invalid line in response header; the bug had appeared in 0.1.26.
*) Bugfix: the segmentation fault may occurred in FastCGI fault
tolerance configuration.
*) Bugfix: the "expires" directive did not remove the previous
"Expires" and "Cache-Control" headers.
*) Bugfix: nginx did not take into account trailing dot in "Host"
header line.
*) Bugfix: the ngx_http_auth_module did not work under Linux.
*) Bugfix: the rewrite directive worked incorrectly, if the arguments
were in a request.
*) Bugfix: nginx could not be built on MacOS X.
2005-05-12 22:58:06 +08:00
|
|
|
if (*a == NULL) {
|
|
|
|
return NGX_CONF_ERROR;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-05-11 22:43:47 +08:00
|
|
|
kv = ngx_array_push(*a);
|
|
|
|
if (kv == NULL) {
|
nginx-0.1.29-RELEASE import
*) Feature: the ngx_http_ssi_module supports "include virtual" command.
*) Feature: the ngx_http_ssi_module supports the condition command like
'if expr="$NAME"' and "else" and "endif" commands. Only one nested
level is supported.
*) Feature: the ngx_http_ssi_module supports the DATE_LOCAL and
DATE_GMT variables and "config timefmt" command.
*) Feature: the "ssi_ignore_recycled_buffers" directive.
*) Bugfix: the "echo" command did not show the default value for the
empty QUERY_STRING variable.
*) Change: the ngx_http_proxy_module was rewritten.
*) Feature: the "proxy_redirect", "proxy_pass_request_headers",
"proxy_pass_request_body", and "proxy_method" directives.
*) Feature: the "proxy_set_header" directive. The "proxy_x_var" was
canceled and must be replaced with the proxy_set_header directive.
*) Change: the "proxy_preserve_host" is canceled and must be replaced
with the "proxy_set_header Host $host" and the "proxy_redirect off"
directives, the "proxy_set_header Host $host:$proxy_port" directive
and the appropriate proxy_redirect directives.
*) Change: the "proxy_set_x_real_ip" is canceled and must be replaced
with the "proxy_set_header X-Real-IP $remote_addr" directive.
*) Change: the "proxy_add_x_forwarded_for" is canceled and must be
replaced with
the "proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for"
directive.
*) Change: the "proxy_set_x_url" is canceled and must be replaced with
the "proxy_set_header X-URL http://$host:$server_port$request_uri"
directive.
*) Feature: the "fastcgi_param" directive.
*) Change: the "fastcgi_root", "fastcgi_set_var" and "fastcgi_params"
directive are canceled and must be replaced with the fastcgi_param
directives.
*) Feature: the "index" directive can use the variables.
*) Feature: the "index" directive can be used at http and server levels.
*) Change: the last index only in the "index" directive can be absolute.
*) Feature: the "rewrite" directive can use the variables.
*) Feature: the "internal" directive.
*) Feature: the CONTENT_LENGTH, CONTENT_TYPE, REMOTE_PORT, SERVER_ADDR,
SERVER_PORT, SERVER_PROTOCOL, DOCUMENT_ROOT, SERVER_NAME,
REQUEST_METHOD, REQUEST_URI, and REMOTE_USER variables.
*) Change: nginx now passes the invalid lines in a client request
headers or a backend response header.
*) Bugfix: if the backend did not transfer response for a long time and
the "send_timeout" was less than "proxy_read_timeout", then nginx
returned the 408 response.
*) Bugfix: the segmentation fault was occurred if the backend sent an
invalid line in response header; the bug had appeared in 0.1.26.
*) Bugfix: the segmentation fault may occurred in FastCGI fault
tolerance configuration.
*) Bugfix: the "expires" directive did not remove the previous
"Expires" and "Cache-Control" headers.
*) Bugfix: nginx did not take into account trailing dot in "Host"
header line.
*) Bugfix: the ngx_http_auth_module did not work under Linux.
*) Bugfix: the rewrite directive worked incorrectly, if the arguments
were in a request.
*) Bugfix: nginx could not be built on MacOS X.
2005-05-12 22:58:06 +08:00
|
|
|
return NGX_CONF_ERROR;
|
|
|
|
}
|
|
|
|
|
|
|
|
value = cf->args->elts;
|
|
|
|
|
2006-05-11 22:43:47 +08:00
|
|
|
kv->key = value[1];
|
|
|
|
kv->value = value[2];
|
nginx-0.1.29-RELEASE import
*) Feature: the ngx_http_ssi_module supports "include virtual" command.
*) Feature: the ngx_http_ssi_module supports the condition command like
'if expr="$NAME"' and "else" and "endif" commands. Only one nested
level is supported.
*) Feature: the ngx_http_ssi_module supports the DATE_LOCAL and
DATE_GMT variables and "config timefmt" command.
*) Feature: the "ssi_ignore_recycled_buffers" directive.
*) Bugfix: the "echo" command did not show the default value for the
empty QUERY_STRING variable.
*) Change: the ngx_http_proxy_module was rewritten.
*) Feature: the "proxy_redirect", "proxy_pass_request_headers",
"proxy_pass_request_body", and "proxy_method" directives.
*) Feature: the "proxy_set_header" directive. The "proxy_x_var" was
canceled and must be replaced with the proxy_set_header directive.
*) Change: the "proxy_preserve_host" is canceled and must be replaced
with the "proxy_set_header Host $host" and the "proxy_redirect off"
directives, the "proxy_set_header Host $host:$proxy_port" directive
and the appropriate proxy_redirect directives.
*) Change: the "proxy_set_x_real_ip" is canceled and must be replaced
with the "proxy_set_header X-Real-IP $remote_addr" directive.
*) Change: the "proxy_add_x_forwarded_for" is canceled and must be
replaced with
the "proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for"
directive.
*) Change: the "proxy_set_x_url" is canceled and must be replaced with
the "proxy_set_header X-URL http://$host:$server_port$request_uri"
directive.
*) Feature: the "fastcgi_param" directive.
*) Change: the "fastcgi_root", "fastcgi_set_var" and "fastcgi_params"
directive are canceled and must be replaced with the fastcgi_param
directives.
*) Feature: the "index" directive can use the variables.
*) Feature: the "index" directive can be used at http and server levels.
*) Change: the last index only in the "index" directive can be absolute.
*) Feature: the "rewrite" directive can use the variables.
*) Feature: the "internal" directive.
*) Feature: the CONTENT_LENGTH, CONTENT_TYPE, REMOTE_PORT, SERVER_ADDR,
SERVER_PORT, SERVER_PROTOCOL, DOCUMENT_ROOT, SERVER_NAME,
REQUEST_METHOD, REQUEST_URI, and REMOTE_USER variables.
*) Change: nginx now passes the invalid lines in a client request
headers or a backend response header.
*) Bugfix: if the backend did not transfer response for a long time and
the "send_timeout" was less than "proxy_read_timeout", then nginx
returned the 408 response.
*) Bugfix: the segmentation fault was occurred if the backend sent an
invalid line in response header; the bug had appeared in 0.1.26.
*) Bugfix: the segmentation fault may occurred in FastCGI fault
tolerance configuration.
*) Bugfix: the "expires" directive did not remove the previous
"Expires" and "Cache-Control" headers.
*) Bugfix: nginx did not take into account trailing dot in "Host"
header line.
*) Bugfix: the ngx_http_auth_module did not work under Linux.
*) Bugfix: the rewrite directive worked incorrectly, if the arguments
were in a request.
*) Bugfix: nginx could not be built on MacOS X.
2005-05-12 22:58:06 +08:00
|
|
|
|
|
|
|
if (cmd->post) {
|
|
|
|
post = cmd->post;
|
2006-05-11 22:43:47 +08:00
|
|
|
return post->post_handler(cf, post, kv);
|
nginx-0.1.29-RELEASE import
*) Feature: the ngx_http_ssi_module supports "include virtual" command.
*) Feature: the ngx_http_ssi_module supports the condition command like
'if expr="$NAME"' and "else" and "endif" commands. Only one nested
level is supported.
*) Feature: the ngx_http_ssi_module supports the DATE_LOCAL and
DATE_GMT variables and "config timefmt" command.
*) Feature: the "ssi_ignore_recycled_buffers" directive.
*) Bugfix: the "echo" command did not show the default value for the
empty QUERY_STRING variable.
*) Change: the ngx_http_proxy_module was rewritten.
*) Feature: the "proxy_redirect", "proxy_pass_request_headers",
"proxy_pass_request_body", and "proxy_method" directives.
*) Feature: the "proxy_set_header" directive. The "proxy_x_var" was
canceled and must be replaced with the proxy_set_header directive.
*) Change: the "proxy_preserve_host" is canceled and must be replaced
with the "proxy_set_header Host $host" and the "proxy_redirect off"
directives, the "proxy_set_header Host $host:$proxy_port" directive
and the appropriate proxy_redirect directives.
*) Change: the "proxy_set_x_real_ip" is canceled and must be replaced
with the "proxy_set_header X-Real-IP $remote_addr" directive.
*) Change: the "proxy_add_x_forwarded_for" is canceled and must be
replaced with
the "proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for"
directive.
*) Change: the "proxy_set_x_url" is canceled and must be replaced with
the "proxy_set_header X-URL http://$host:$server_port$request_uri"
directive.
*) Feature: the "fastcgi_param" directive.
*) Change: the "fastcgi_root", "fastcgi_set_var" and "fastcgi_params"
directive are canceled and must be replaced with the fastcgi_param
directives.
*) Feature: the "index" directive can use the variables.
*) Feature: the "index" directive can be used at http and server levels.
*) Change: the last index only in the "index" directive can be absolute.
*) Feature: the "rewrite" directive can use the variables.
*) Feature: the "internal" directive.
*) Feature: the CONTENT_LENGTH, CONTENT_TYPE, REMOTE_PORT, SERVER_ADDR,
SERVER_PORT, SERVER_PROTOCOL, DOCUMENT_ROOT, SERVER_NAME,
REQUEST_METHOD, REQUEST_URI, and REMOTE_USER variables.
*) Change: nginx now passes the invalid lines in a client request
headers or a backend response header.
*) Bugfix: if the backend did not transfer response for a long time and
the "send_timeout" was less than "proxy_read_timeout", then nginx
returned the 408 response.
*) Bugfix: the segmentation fault was occurred if the backend sent an
invalid line in response header; the bug had appeared in 0.1.26.
*) Bugfix: the segmentation fault may occurred in FastCGI fault
tolerance configuration.
*) Bugfix: the "expires" directive did not remove the previous
"Expires" and "Cache-Control" headers.
*) Bugfix: nginx did not take into account trailing dot in "Host"
header line.
*) Bugfix: the ngx_http_auth_module did not work under Linux.
*) Bugfix: the rewrite directive worked incorrectly, if the arguments
were in a request.
*) Bugfix: nginx could not be built on MacOS X.
2005-05-12 22:58:06 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
return NGX_CONF_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-03-23 00:02:46 +08:00
|
|
|
char *
|
|
|
|
ngx_conf_set_num_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
2003-05-16 23:27:48 +08:00
|
|
|
{
|
2003-05-30 22:27:59 +08:00
|
|
|
char *p = conf;
|
|
|
|
|
2004-02-21 00:48:59 +08:00
|
|
|
ngx_int_t *np;
|
2003-10-24 14:53:41 +08:00
|
|
|
ngx_str_t *value;
|
|
|
|
ngx_conf_post_t *post;
|
2003-05-16 23:27:48 +08:00
|
|
|
|
2003-10-23 14:13:16 +08:00
|
|
|
|
2004-02-21 00:48:59 +08:00
|
|
|
np = (ngx_int_t *) (p + cmd->offset);
|
2003-10-23 14:13:16 +08:00
|
|
|
|
|
|
|
if (*np != NGX_CONF_UNSET) {
|
2003-05-20 23:37:55 +08:00
|
|
|
return "is duplicate";
|
|
|
|
}
|
|
|
|
|
2004-04-14 13:57:36 +08:00
|
|
|
value = cf->args->elts;
|
2003-10-23 14:13:16 +08:00
|
|
|
*np = ngx_atoi(value[1].data, value[1].len);
|
|
|
|
if (*np == NGX_ERROR) {
|
2003-05-30 22:27:59 +08:00
|
|
|
return "invalid number";
|
2003-05-16 23:27:48 +08:00
|
|
|
}
|
|
|
|
|
2003-10-24 14:53:41 +08:00
|
|
|
if (cmd->post) {
|
|
|
|
post = cmd->post;
|
|
|
|
return post->post_handler(cf, post, np);
|
2003-10-23 14:13:16 +08:00
|
|
|
}
|
2003-05-16 23:27:48 +08:00
|
|
|
|
|
|
|
return NGX_CONF_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-03-23 00:02:46 +08:00
|
|
|
char *
|
|
|
|
ngx_conf_set_size_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
2002-12-26 15:24:21 +08:00
|
|
|
{
|
2003-05-30 22:27:59 +08:00
|
|
|
char *p = conf;
|
|
|
|
|
2004-03-16 15:10:12 +08:00
|
|
|
size_t *sp;
|
2003-10-24 14:53:41 +08:00
|
|
|
ngx_str_t *value;
|
|
|
|
ngx_conf_post_t *post;
|
2002-12-26 15:24:21 +08:00
|
|
|
|
2003-10-23 14:13:16 +08:00
|
|
|
|
2004-03-16 15:10:12 +08:00
|
|
|
sp = (size_t *) (p + cmd->offset);
|
|
|
|
if (*sp != NGX_CONF_UNSET_SIZE) {
|
2003-05-20 23:37:55 +08:00
|
|
|
return "is duplicate";
|
|
|
|
}
|
|
|
|
|
2004-04-14 13:57:36 +08:00
|
|
|
value = cf->args->elts;
|
2002-12-26 15:24:21 +08:00
|
|
|
|
2004-02-21 00:48:59 +08:00
|
|
|
*sp = ngx_parse_size(&value[1]);
|
2004-03-16 15:10:12 +08:00
|
|
|
if (*sp == (size_t) NGX_ERROR) {
|
2003-05-07 01:03:16 +08:00
|
|
|
return "invalid value";
|
2002-12-26 15:24:21 +08:00
|
|
|
}
|
|
|
|
|
2003-10-24 14:53:41 +08:00
|
|
|
if (cmd->post) {
|
|
|
|
post = cmd->post;
|
2004-02-21 00:48:59 +08:00
|
|
|
return post->post_handler(cf, post, sp);
|
2003-10-23 14:13:16 +08:00
|
|
|
}
|
2002-09-11 23:18:33 +08:00
|
|
|
|
2003-01-09 13:36:00 +08:00
|
|
|
return NGX_CONF_OK;
|
2002-09-11 23:18:33 +08:00
|
|
|
}
|
2002-09-16 23:01:44 +08:00
|
|
|
|
2002-12-26 15:24:21 +08:00
|
|
|
|
2006-07-08 00:33:19 +08:00
|
|
|
char *
|
|
|
|
ngx_conf_set_off_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
|
|
|
{
|
|
|
|
char *p = conf;
|
|
|
|
|
|
|
|
off_t *op;
|
|
|
|
ngx_str_t *value;
|
|
|
|
ngx_conf_post_t *post;
|
|
|
|
|
|
|
|
|
|
|
|
op = (off_t *) (p + cmd->offset);
|
|
|
|
if (*op != NGX_CONF_UNSET) {
|
|
|
|
return "is duplicate";
|
|
|
|
}
|
|
|
|
|
|
|
|
value = cf->args->elts;
|
|
|
|
|
|
|
|
*op = ngx_parse_offset(&value[1]);
|
|
|
|
if (*op == (off_t) NGX_ERROR) {
|
|
|
|
return "invalid value";
|
|
|
|
}
|
|
|
|
|
|
|
|
if (cmd->post) {
|
|
|
|
post = cmd->post;
|
|
|
|
return post->post_handler(cf, post, op);
|
|
|
|
}
|
|
|
|
|
|
|
|
return NGX_CONF_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-03-23 00:02:46 +08:00
|
|
|
char *
|
|
|
|
ngx_conf_set_msec_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
2002-09-16 23:01:44 +08:00
|
|
|
{
|
2003-05-30 22:27:59 +08:00
|
|
|
char *p = conf;
|
|
|
|
|
2004-02-21 00:48:59 +08:00
|
|
|
ngx_msec_t *msp;
|
2003-10-24 14:53:41 +08:00
|
|
|
ngx_str_t *value;
|
|
|
|
ngx_conf_post_t *post;
|
2002-12-26 15:24:21 +08:00
|
|
|
|
2003-10-23 14:13:16 +08:00
|
|
|
|
2004-02-21 00:48:59 +08:00
|
|
|
msp = (ngx_msec_t *) (p + cmd->offset);
|
2004-03-16 15:10:12 +08:00
|
|
|
if (*msp != NGX_CONF_UNSET_MSEC) {
|
2003-05-20 23:37:55 +08:00
|
|
|
return "is duplicate";
|
|
|
|
}
|
|
|
|
|
2004-04-14 13:57:36 +08:00
|
|
|
value = cf->args->elts;
|
2003-04-28 23:06:39 +08:00
|
|
|
|
2004-02-21 00:48:59 +08:00
|
|
|
*msp = ngx_parse_time(&value[1], 0);
|
|
|
|
if (*msp == (ngx_msec_t) NGX_ERROR) {
|
2003-10-23 23:54:19 +08:00
|
|
|
return "invalid value";
|
2002-12-26 15:24:21 +08:00
|
|
|
}
|
2002-09-16 23:01:44 +08:00
|
|
|
|
2003-10-24 14:53:41 +08:00
|
|
|
if (cmd->post) {
|
|
|
|
post = cmd->post;
|
2004-02-21 00:48:59 +08:00
|
|
|
return post->post_handler(cf, post, msp);
|
2003-10-23 14:13:16 +08:00
|
|
|
}
|
2003-04-28 23:06:39 +08:00
|
|
|
|
2003-05-07 01:03:16 +08:00
|
|
|
return NGX_CONF_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-03-23 00:02:46 +08:00
|
|
|
char *
|
|
|
|
ngx_conf_set_sec_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
2003-05-07 01:03:16 +08:00
|
|
|
{
|
2003-05-30 22:27:59 +08:00
|
|
|
char *p = conf;
|
|
|
|
|
2004-02-21 00:48:59 +08:00
|
|
|
time_t *sp;
|
2003-10-24 14:53:41 +08:00
|
|
|
ngx_str_t *value;
|
|
|
|
ngx_conf_post_t *post;
|
2003-05-07 01:03:16 +08:00
|
|
|
|
2003-10-23 14:13:16 +08:00
|
|
|
|
2004-02-21 00:48:59 +08:00
|
|
|
sp = (time_t *) (p + cmd->offset);
|
|
|
|
if (*sp != NGX_CONF_UNSET) {
|
2003-05-20 23:37:55 +08:00
|
|
|
return "is duplicate";
|
|
|
|
}
|
|
|
|
|
2004-04-14 13:57:36 +08:00
|
|
|
value = cf->args->elts;
|
2003-05-07 01:03:16 +08:00
|
|
|
|
2004-02-21 00:48:59 +08:00
|
|
|
*sp = ngx_parse_time(&value[1], 1);
|
2012-02-13 23:41:11 +08:00
|
|
|
if (*sp == (time_t) NGX_ERROR) {
|
2003-10-23 23:54:19 +08:00
|
|
|
return "invalid value";
|
2003-05-07 01:03:16 +08:00
|
|
|
}
|
|
|
|
|
2003-10-24 14:53:41 +08:00
|
|
|
if (cmd->post) {
|
|
|
|
post = cmd->post;
|
2004-02-21 00:48:59 +08:00
|
|
|
return post->post_handler(cf, post, sp);
|
2003-10-23 14:13:16 +08:00
|
|
|
}
|
2002-12-26 15:24:21 +08:00
|
|
|
|
2003-01-09 13:36:00 +08:00
|
|
|
return NGX_CONF_OK;
|
2002-09-16 23:01:44 +08:00
|
|
|
}
|
2003-03-04 14:33:48 +08:00
|
|
|
|
2003-05-07 01:03:16 +08:00
|
|
|
|
2005-03-23 00:02:46 +08:00
|
|
|
char *
|
|
|
|
ngx_conf_set_bufs_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
2003-10-08 23:32:54 +08:00
|
|
|
{
|
2003-10-30 16:51:06 +08:00
|
|
|
char *p = conf;
|
2003-10-08 23:32:54 +08:00
|
|
|
|
|
|
|
ngx_str_t *value;
|
|
|
|
ngx_bufs_t *bufs;
|
|
|
|
|
|
|
|
|
|
|
|
bufs = (ngx_bufs_t *) (p + cmd->offset);
|
|
|
|
if (bufs->num) {
|
|
|
|
return "is duplicate";
|
|
|
|
}
|
|
|
|
|
2004-04-14 13:57:36 +08:00
|
|
|
value = cf->args->elts;
|
2003-10-08 23:32:54 +08:00
|
|
|
|
|
|
|
bufs->num = ngx_atoi(value[1].data, value[1].len);
|
|
|
|
if (bufs->num == NGX_ERROR || bufs->num == 0) {
|
|
|
|
return "invalid value";
|
|
|
|
}
|
|
|
|
|
2003-10-23 23:54:19 +08:00
|
|
|
bufs->size = ngx_parse_size(&value[2]);
|
2003-10-31 00:51:33 +08:00
|
|
|
if (bufs->size == (size_t) NGX_ERROR || bufs->size == 0) {
|
2003-10-08 23:32:54 +08:00
|
|
|
return "invalid value";
|
|
|
|
}
|
|
|
|
|
|
|
|
return NGX_CONF_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-03-23 00:02:46 +08:00
|
|
|
char *
|
|
|
|
ngx_conf_set_enum_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
2004-04-14 13:57:36 +08:00
|
|
|
{
|
|
|
|
char *p = conf;
|
|
|
|
|
|
|
|
ngx_uint_t *np, i;
|
|
|
|
ngx_str_t *value;
|
|
|
|
ngx_conf_enum_t *e;
|
|
|
|
|
|
|
|
np = (ngx_uint_t *) (p + cmd->offset);
|
|
|
|
|
|
|
|
if (*np != NGX_CONF_UNSET_UINT) {
|
|
|
|
return "is duplicate";
|
|
|
|
}
|
|
|
|
|
|
|
|
value = cf->args->elts;
|
|
|
|
e = cmd->post;
|
|
|
|
|
|
|
|
for (i = 0; e[i].name.len != 0; i++) {
|
|
|
|
if (e[i].name.len != value[1].len
|
|
|
|
|| ngx_strcasecmp(e[i].name.data, value[1].data) != 0)
|
|
|
|
{
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
*np = e[i].value;
|
|
|
|
|
|
|
|
return NGX_CONF_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
ngx_conf_log_error(NGX_LOG_WARN, cf, 0,
|
|
|
|
"invalid value \"%s\"", value[1].data);
|
|
|
|
|
|
|
|
return NGX_CONF_ERROR;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-03-23 00:02:46 +08:00
|
|
|
char *
|
|
|
|
ngx_conf_set_bitmask_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
2003-10-30 16:51:06 +08:00
|
|
|
{
|
|
|
|
char *p = conf;
|
|
|
|
|
2004-03-16 15:10:12 +08:00
|
|
|
ngx_uint_t *np, i, m;
|
2003-10-30 16:51:06 +08:00
|
|
|
ngx_str_t *value;
|
|
|
|
ngx_conf_bitmask_t *mask;
|
|
|
|
|
|
|
|
|
2004-03-16 15:10:12 +08:00
|
|
|
np = (ngx_uint_t *) (p + cmd->offset);
|
2004-04-14 13:57:36 +08:00
|
|
|
value = cf->args->elts;
|
2003-10-30 16:51:06 +08:00
|
|
|
mask = cmd->post;
|
|
|
|
|
|
|
|
for (i = 1; i < cf->args->nelts; i++) {
|
|
|
|
for (m = 0; mask[m].name.len != 0; m++) {
|
|
|
|
|
|
|
|
if (mask[m].name.len != value[i].len
|
2004-04-14 13:57:36 +08:00
|
|
|
|| ngx_strcasecmp(mask[m].name.data, value[i].data) != 0)
|
2003-10-30 16:51:06 +08:00
|
|
|
{
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (*np & mask[m].mask) {
|
|
|
|
ngx_conf_log_error(NGX_LOG_WARN, cf, 0,
|
|
|
|
"duplicate value \"%s\"", value[i].data);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
*np |= mask[m].mask;
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (mask[m].name.len == 0) {
|
|
|
|
ngx_conf_log_error(NGX_LOG_WARN, cf, 0,
|
|
|
|
"invalid value \"%s\"", value[i].data);
|
|
|
|
|
|
|
|
return NGX_CONF_ERROR;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return NGX_CONF_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-07-24 23:09:54 +08:00
|
|
|
#if 0
|
|
|
|
|
2005-03-23 00:02:46 +08:00
|
|
|
char *
|
|
|
|
ngx_conf_unsupported(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
2003-03-04 14:33:48 +08:00
|
|
|
{
|
|
|
|
return "unsupported on this platform";
|
|
|
|
}
|
2003-10-23 14:13:16 +08:00
|
|
|
|
2012-07-24 23:09:54 +08:00
|
|
|
#endif
|
|
|
|
|
2003-10-23 14:13:16 +08:00
|
|
|
|
2005-11-26 18:11:11 +08:00
|
|
|
char *
|
|
|
|
ngx_conf_deprecated(ngx_conf_t *cf, void *post, void *data)
|
|
|
|
{
|
|
|
|
ngx_conf_deprecated_t *d = post;
|
|
|
|
|
|
|
|
ngx_conf_log_error(NGX_LOG_WARN, cf, 0,
|
|
|
|
"the \"%s\" directive is deprecated, "
|
|
|
|
"use the \"%s\" directive instead",
|
|
|
|
d->old_name, d->new_name);
|
|
|
|
|
|
|
|
return NGX_CONF_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-03-23 00:02:46 +08:00
|
|
|
char *
|
|
|
|
ngx_conf_check_num_bounds(ngx_conf_t *cf, void *post, void *data)
|
2003-10-23 14:13:16 +08:00
|
|
|
{
|
2004-05-28 23:49:23 +08:00
|
|
|
ngx_conf_num_bounds_t *bounds = post;
|
|
|
|
ngx_int_t *np = data;
|
2003-10-23 14:13:16 +08:00
|
|
|
|
2003-11-04 06:20:44 +08:00
|
|
|
if (bounds->high == -1) {
|
|
|
|
if (*np >= bounds->low) {
|
|
|
|
return NGX_CONF_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
|
2012-04-13 03:35:41 +08:00
|
|
|
"value must be equal to or greater than %i",
|
|
|
|
bounds->low);
|
2003-11-04 06:20:44 +08:00
|
|
|
|
|
|
|
return NGX_CONF_ERROR;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (*np >= bounds->low && *np <= bounds->high) {
|
2003-10-23 14:13:16 +08:00
|
|
|
return NGX_CONF_OK;
|
|
|
|
}
|
|
|
|
|
2003-11-04 06:20:44 +08:00
|
|
|
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
|
2005-04-08 23:18:55 +08:00
|
|
|
"value must be between %i and %i",
|
2003-11-04 06:20:44 +08:00
|
|
|
bounds->low, bounds->high);
|
|
|
|
|
|
|
|
return NGX_CONF_ERROR;
|
2003-10-23 14:13:16 +08:00
|
|
|
}
|