2003-04-12 00:01:14 +08:00
|
|
|
|
2004-09-28 16:34:51 +08:00
|
|
|
/*
|
2004-09-30 00:00:49 +08:00
|
|
|
* Copyright (C) Igor Sysoev
|
2004-09-28 16:34:51 +08:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
2003-04-12 00:01:14 +08:00
|
|
|
#include <ngx_config.h>
|
|
|
|
#include <ngx_core.h>
|
|
|
|
|
|
|
|
|
2005-02-24 20:29:09 +08:00
|
|
|
static ngx_atomic_uint_t ngx_temp_number;
|
2006-10-23 21:10:10 +08:00
|
|
|
static ngx_atomic_uint_t ngx_random_number;
|
2003-04-28 23:06:39 +08:00
|
|
|
|
|
|
|
|
2005-02-22 22:40:13 +08:00
|
|
|
ssize_t
|
|
|
|
ngx_write_chain_to_temp_file(ngx_temp_file_t *tf, ngx_chain_t *chain)
|
2003-10-27 16:53:49 +08:00
|
|
|
{
|
2004-11-21 03:52:20 +08:00
|
|
|
ngx_int_t rc;
|
2003-10-27 16:53:49 +08:00
|
|
|
|
|
|
|
if (tf->file.fd == NGX_INVALID_FILE) {
|
2003-11-03 06:56:18 +08:00
|
|
|
rc = ngx_create_temp_file(&tf->file, tf->path, tf->pool,
|
2007-01-25 16:45:04 +08:00
|
|
|
tf->persistent, tf->clean, tf->access);
|
2003-12-09 04:48:12 +08:00
|
|
|
|
2003-10-27 16:53:49 +08:00
|
|
|
if (rc == NGX_ERROR || rc == NGX_AGAIN) {
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
2006-07-28 23:16:17 +08:00
|
|
|
if (tf->log_level) {
|
|
|
|
ngx_log_error(tf->log_level, tf->file.log, 0, "%s %V",
|
2006-04-19 23:30:56 +08:00
|
|
|
tf->warn, &tf->file.name);
|
2003-10-27 16:53:49 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-11-03 06:56:18 +08:00
|
|
|
return ngx_write_chain_to_file(&tf->file, chain, tf->offset, tf->pool);
|
2003-10-27 16:53:49 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-02-22 22:40:13 +08:00
|
|
|
ngx_int_t
|
|
|
|
ngx_create_temp_file(ngx_file_t *file, ngx_path_t *path, ngx_pool_t *pool,
|
2007-01-25 16:45:04 +08:00
|
|
|
ngx_uint_t persistent, ngx_uint_t clean, ngx_uint_t access)
|
2003-04-12 00:01:14 +08:00
|
|
|
{
|
2007-01-30 04:28:00 +08:00
|
|
|
uint32_t n;
|
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_err_t err;
|
2005-10-19 20:33:58 +08:00
|
|
|
ngx_pool_cleanup_t *cln;
|
|
|
|
ngx_pool_cleanup_file_t *clnf;
|
2003-04-12 00:01:14 +08:00
|
|
|
|
2007-01-30 04:33:51 +08:00
|
|
|
file->name.len = path->name.len + 1 + path->len + 10;
|
2003-04-12 00:01:14 +08:00
|
|
|
|
2005-03-19 20:38:37 +08:00
|
|
|
file->name.data = ngx_palloc(pool, file->name.len + 1);
|
|
|
|
if (file->name.data == NULL) {
|
2004-11-21 03:52:20 +08:00
|
|
|
return NGX_ERROR;
|
|
|
|
}
|
2003-04-12 00:01:14 +08:00
|
|
|
|
|
|
|
#if 0
|
|
|
|
for (i = 0; i < file->name.len; i++) {
|
|
|
|
file->name.data[i] = 'X';
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
ngx_memcpy(file->name.data, path->name.data, path->name.len);
|
|
|
|
|
2007-01-30 04:28:00 +08:00
|
|
|
n = (uint32_t) ngx_next_temp_number(0);
|
2003-04-28 23:06:39 +08:00
|
|
|
|
2003-04-12 00:01:14 +08:00
|
|
|
for ( ;; ) {
|
2005-05-23 20:07:45 +08:00
|
|
|
(void) ngx_sprintf(file->name.data + path->name.len + 1 + path->len,
|
2007-01-30 04:28:00 +08:00
|
|
|
"%010uD%Z", n);
|
2003-04-12 00:01:14 +08:00
|
|
|
|
|
|
|
ngx_create_hashed_filename(file, path);
|
|
|
|
|
2005-10-19 20:33:58 +08:00
|
|
|
cln = ngx_pool_cleanup_add(pool, sizeof(ngx_pool_cleanup_file_t));
|
|
|
|
if (cln == NULL) {
|
|
|
|
return NGX_ERROR;
|
|
|
|
}
|
|
|
|
|
2007-01-19 03:52:18 +08:00
|
|
|
file->fd = ngx_open_tempfile(file->name.data, persistent, access);
|
2003-04-12 00:01:14 +08:00
|
|
|
|
2004-02-12 01:08:49 +08:00
|
|
|
ngx_log_debug1(NGX_LOG_DEBUG_CORE, file->log, 0,
|
|
|
|
"temp fd:%d", file->fd);
|
2003-04-15 01:04:58 +08:00
|
|
|
|
2003-04-12 00:01:14 +08:00
|
|
|
if (file->fd != NGX_INVALID_FILE) {
|
2005-10-19 20:33:58 +08:00
|
|
|
|
2007-01-25 16:45:04 +08:00
|
|
|
cln->handler = clean ? ngx_pool_delete_file : ngx_pool_cleanup_file;
|
2005-10-19 20:33:58 +08:00
|
|
|
clnf = cln->data;
|
|
|
|
|
|
|
|
clnf->fd = file->fd;
|
|
|
|
clnf->name = file->name.data;
|
|
|
|
clnf->log = pool->log;
|
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
|
|
|
|
2003-04-12 00:01:14 +08:00
|
|
|
return NGX_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
err = ngx_errno;
|
|
|
|
|
|
|
|
if (err == NGX_EEXIST) {
|
2007-01-30 04:28:00 +08:00
|
|
|
n = (uint32_t) ngx_next_temp_number(1);
|
2003-04-12 00:01:14 +08:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2004-04-26 04:13:21 +08:00
|
|
|
if ((path->level[0] == 0)
|
|
|
|
|| (err != NGX_ENOENT
|
2004-11-11 22:07:14 +08:00
|
|
|
#if (NGX_WIN32)
|
2004-04-26 04:13:21 +08:00
|
|
|
&& err != NGX_ENOTDIR
|
2003-04-12 00:01:14 +08:00
|
|
|
#endif
|
2004-11-21 03:52:20 +08:00
|
|
|
))
|
|
|
|
{
|
2003-04-12 00:01:14 +08:00
|
|
|
ngx_log_error(NGX_LOG_CRIT, file->log, err,
|
|
|
|
ngx_open_tempfile_n " \"%s\" failed",
|
|
|
|
file->name.data);
|
|
|
|
return NGX_ERROR;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ngx_create_path(file, path) == NGX_ERROR) {
|
|
|
|
return NGX_ERROR;
|
2003-05-21 21:28:21 +08:00
|
|
|
}
|
2003-04-12 00:01:14 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-02-22 22:40:13 +08:00
|
|
|
void
|
|
|
|
ngx_create_hashed_filename(ngx_file_t *file, ngx_path_t *path)
|
2003-04-12 00:01:14 +08:00
|
|
|
{
|
2005-05-23 20:07:45 +08:00
|
|
|
size_t name, pos, level;
|
|
|
|
ngx_uint_t i;
|
2003-04-12 00:01:14 +08:00
|
|
|
|
|
|
|
name = file->name.len;
|
|
|
|
pos = path->name.len + 1;
|
|
|
|
|
|
|
|
file->name.data[path->name.len + path->len] = '/';
|
|
|
|
|
|
|
|
for (i = 0; i < 3; i++) {
|
|
|
|
level = path->level[i];
|
|
|
|
|
|
|
|
if (level == 0) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
name -= level;
|
|
|
|
file->name.data[pos - 1] = '/';
|
|
|
|
ngx_memcpy(&file->name.data[pos], &file->name.data[name], level);
|
|
|
|
pos += level + 1;
|
|
|
|
}
|
|
|
|
|
2004-02-12 01:08:49 +08:00
|
|
|
ngx_log_debug1(NGX_LOG_DEBUG_CORE, file->log, 0,
|
|
|
|
"hashed path: %s", file->name.data);
|
2003-04-12 00:01:14 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-02-22 22:40:13 +08:00
|
|
|
ngx_int_t
|
|
|
|
ngx_create_path(ngx_file_t *file, ngx_path_t *path)
|
2003-04-12 00:01:14 +08:00
|
|
|
{
|
2005-05-23 20:07:45 +08:00
|
|
|
size_t pos;
|
|
|
|
ngx_err_t err;
|
|
|
|
ngx_uint_t i;
|
2003-04-12 00:01:14 +08:00
|
|
|
|
|
|
|
pos = path->name.len;
|
|
|
|
|
|
|
|
for (i = 0; i < 3; i++) {
|
|
|
|
if (path->level[i] == 0) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
pos += path->level[i] + 1;
|
|
|
|
|
|
|
|
file->name.data[pos] = '\0';
|
|
|
|
|
2004-02-12 01:08:49 +08:00
|
|
|
ngx_log_debug1(NGX_LOG_DEBUG_CORE, file->log, 0,
|
|
|
|
"temp file: \"%s\"", file->name.data);
|
2003-04-12 00:01:14 +08:00
|
|
|
|
2006-08-05 00:04:04 +08:00
|
|
|
if (ngx_create_dir(file->name.data, 0700) == NGX_FILE_ERROR) {
|
2003-04-12 00:01:14 +08:00
|
|
|
err = ngx_errno;
|
|
|
|
if (err != NGX_EEXIST) {
|
|
|
|
ngx_log_error(NGX_LOG_CRIT, file->log, err,
|
2003-11-17 05:49:42 +08:00
|
|
|
ngx_create_dir_n " \"%s\" failed",
|
|
|
|
file->name.data);
|
2003-04-12 00:01:14 +08:00
|
|
|
return NGX_ERROR;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
file->name.data[pos] = '/';
|
|
|
|
}
|
|
|
|
|
|
|
|
return NGX_OK;
|
|
|
|
}
|
2003-04-28 23:06:39 +08:00
|
|
|
|
|
|
|
|
2006-04-19 23:30:56 +08:00
|
|
|
ngx_err_t
|
2006-08-05 00:04:04 +08:00
|
|
|
ngx_create_full_path(u_char *dir, ngx_uint_t access)
|
2006-04-19 23:30:56 +08:00
|
|
|
{
|
|
|
|
u_char *p, ch;
|
|
|
|
ngx_err_t err;
|
|
|
|
|
|
|
|
for (p = dir + 1; *p; p++) {
|
|
|
|
ch = *p;
|
|
|
|
|
|
|
|
if (ch != '/') {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
*p = '\0';
|
|
|
|
|
2006-08-05 00:04:04 +08:00
|
|
|
if (ngx_create_dir(dir, access) == NGX_FILE_ERROR) {
|
2006-04-19 23:30:56 +08:00
|
|
|
err = ngx_errno;
|
|
|
|
if (err != NGX_EEXIST) {
|
|
|
|
return err;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
*p = '/';
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-02-22 22:40:13 +08:00
|
|
|
void
|
2005-03-04 22:06:57 +08:00
|
|
|
ngx_init_temp_number(void)
|
2003-04-28 23:06:39 +08:00
|
|
|
{
|
2005-02-22 22:40:13 +08:00
|
|
|
ngx_temp_number = 0;
|
2006-10-23 21:10:10 +08:00
|
|
|
ngx_random_number = 123456;
|
2003-04-28 23:06:39 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-02-24 20:29:09 +08:00
|
|
|
ngx_atomic_uint_t
|
2005-02-22 22:40:13 +08:00
|
|
|
ngx_next_temp_number(ngx_uint_t collision)
|
2003-04-28 23:06:39 +08:00
|
|
|
{
|
|
|
|
if (collision) {
|
2006-10-23 21:10:10 +08:00
|
|
|
ngx_temp_number += ngx_random_number;
|
2003-04-28 23:06:39 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
return ngx_temp_number++;
|
|
|
|
}
|
2003-10-23 00:38:26 +08:00
|
|
|
|
|
|
|
|
2005-02-22 22:40:13 +08:00
|
|
|
char *
|
|
|
|
ngx_conf_set_path_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
2003-10-23 00:38:26 +08:00
|
|
|
{
|
|
|
|
char *p = conf;
|
|
|
|
|
2004-11-21 03:52:20 +08:00
|
|
|
ssize_t level;
|
2003-10-23 00:38:26 +08:00
|
|
|
ngx_str_t *value;
|
2006-04-05 21:40:54 +08:00
|
|
|
ngx_uint_t i, n;
|
nginx-0.1.14-RELEASE import
*) Feature: the autoconfiguration directives:
--http-client-body-temp-path=PATH, --http-proxy-temp-path=PATH, and
--http-fastcgi-temp-path=PATH
*) Change: the directory name for the temporary files with the client
request body is specified by directive client_body_temp_path, by
default it is <prefix>/client_body_temp.
*) Feature: the ngx_http_fastcgi_module and the directives:
fastcgi_pass, fastcgi_root, fastcgi_index, fastcgi_params,
fastcgi_connect_timeout, fastcgi_send_timeout, fastcgi_read_timeout,
fastcgi_send_lowat, fastcgi_header_buffer_size, fastcgi_buffers,
fastcgi_busy_buffers_size, fastcgi_temp_path,
fastcgi_max_temp_file_size, fastcgi_temp_file_write_size,
fastcgi_next_upstream, and fastcgi_x_powered_by.
*) Bugfix: the "[alert] zero size buf" error; the bug had appeared in
0.1.3.
*) Change: the URI must be specified after the host name in the
proxy_pass directive.
*) Change: the %3F symbol in the URI was considered as the argument
string start.
*) Feature: the unix domain sockets support in the
ngx_http_proxy_module.
*) Feature: the ssl_engine and ssl_ciphers directives.
Thanks to Sergey Skvortsov for SSL-accelerator.
2005-01-18 21:03:58 +08:00
|
|
|
ngx_path_t *path, **slot;
|
2003-10-23 00:38:26 +08:00
|
|
|
|
2004-11-21 03:52:20 +08:00
|
|
|
slot = (ngx_path_t **) (p + cmd->offset);
|
2003-10-23 00:38:26 +08:00
|
|
|
|
2004-11-21 03:52:20 +08:00
|
|
|
if (*slot) {
|
2003-10-23 00:38:26 +08:00
|
|
|
return "is duplicate";
|
|
|
|
}
|
|
|
|
|
2005-03-19 20:38:37 +08:00
|
|
|
path = ngx_pcalloc(cf->pool, sizeof(ngx_path_t));
|
|
|
|
if (path == NULL) {
|
2004-11-21 03:52:20 +08:00
|
|
|
return NGX_CONF_ERROR;
|
|
|
|
}
|
2003-10-23 00:38:26 +08:00
|
|
|
|
2004-11-21 03:52:20 +08:00
|
|
|
value = cf->args->elts;
|
2003-10-23 00:38:26 +08:00
|
|
|
|
|
|
|
path->name = value[1];
|
2006-04-05 21:40:54 +08:00
|
|
|
|
2006-07-04 00:49:20 +08:00
|
|
|
if (path->name.data[path->name.len - 1] == '/') {
|
|
|
|
path->name.len--;
|
|
|
|
}
|
|
|
|
|
2006-04-05 21:40:54 +08:00
|
|
|
if (ngx_conf_full_name(cf->cycle, &path->name) == NGX_ERROR) {
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2003-10-23 00:38:26 +08:00
|
|
|
path->len = 0;
|
nginx-0.1.14-RELEASE import
*) Feature: the autoconfiguration directives:
--http-client-body-temp-path=PATH, --http-proxy-temp-path=PATH, and
--http-fastcgi-temp-path=PATH
*) Change: the directory name for the temporary files with the client
request body is specified by directive client_body_temp_path, by
default it is <prefix>/client_body_temp.
*) Feature: the ngx_http_fastcgi_module and the directives:
fastcgi_pass, fastcgi_root, fastcgi_index, fastcgi_params,
fastcgi_connect_timeout, fastcgi_send_timeout, fastcgi_read_timeout,
fastcgi_send_lowat, fastcgi_header_buffer_size, fastcgi_buffers,
fastcgi_busy_buffers_size, fastcgi_temp_path,
fastcgi_max_temp_file_size, fastcgi_temp_file_write_size,
fastcgi_next_upstream, and fastcgi_x_powered_by.
*) Bugfix: the "[alert] zero size buf" error; the bug had appeared in
0.1.3.
*) Change: the URI must be specified after the host name in the
proxy_pass directive.
*) Change: the %3F symbol in the URI was considered as the argument
string start.
*) Feature: the unix domain sockets support in the
ngx_http_proxy_module.
*) Feature: the ssl_engine and ssl_ciphers directives.
Thanks to Sergey Skvortsov for SSL-accelerator.
2005-01-18 21:03:58 +08:00
|
|
|
path->cleaner = (ngx_gc_handler_pt) cmd->post;
|
2004-11-21 03:52:20 +08:00
|
|
|
path->conf_file = cf->conf_file->file.name.data;
|
|
|
|
path->line = cf->conf_file->line;
|
2003-10-23 00:38:26 +08:00
|
|
|
|
|
|
|
for (i = 0, n = 2; n < cf->args->nelts; i++, n++) {
|
2003-11-21 14:30:49 +08:00
|
|
|
level = ngx_atoi(value[n].data, value[n].len);
|
|
|
|
if (level == NGX_ERROR || level == 0) {
|
2003-10-23 00:38:26 +08:00
|
|
|
return "invalid value";
|
|
|
|
}
|
|
|
|
|
2003-11-26 04:44:56 +08:00
|
|
|
path->level[i] = level;
|
|
|
|
path->len += level + 1;
|
2003-10-23 00:38:26 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
while (i < 3) {
|
|
|
|
path->level[i++] = 0;
|
|
|
|
}
|
|
|
|
|
nginx-0.1.14-RELEASE import
*) Feature: the autoconfiguration directives:
--http-client-body-temp-path=PATH, --http-proxy-temp-path=PATH, and
--http-fastcgi-temp-path=PATH
*) Change: the directory name for the temporary files with the client
request body is specified by directive client_body_temp_path, by
default it is <prefix>/client_body_temp.
*) Feature: the ngx_http_fastcgi_module and the directives:
fastcgi_pass, fastcgi_root, fastcgi_index, fastcgi_params,
fastcgi_connect_timeout, fastcgi_send_timeout, fastcgi_read_timeout,
fastcgi_send_lowat, fastcgi_header_buffer_size, fastcgi_buffers,
fastcgi_busy_buffers_size, fastcgi_temp_path,
fastcgi_max_temp_file_size, fastcgi_temp_file_write_size,
fastcgi_next_upstream, and fastcgi_x_powered_by.
*) Bugfix: the "[alert] zero size buf" error; the bug had appeared in
0.1.3.
*) Change: the URI must be specified after the host name in the
proxy_pass directive.
*) Change: the %3F symbol in the URI was considered as the argument
string start.
*) Feature: the unix domain sockets support in the
ngx_http_proxy_module.
*) Feature: the ssl_engine and ssl_ciphers directives.
Thanks to Sergey Skvortsov for SSL-accelerator.
2005-01-18 21:03:58 +08:00
|
|
|
*slot = path;
|
|
|
|
|
|
|
|
if (ngx_add_path(cf, slot) == NGX_ERROR) {
|
|
|
|
return NGX_CONF_ERROR;
|
|
|
|
}
|
|
|
|
|
|
|
|
return NGX_CONF_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-07-12 19:19:05 +08:00
|
|
|
char *
|
|
|
|
ngx_conf_set_access_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
|
|
|
{
|
|
|
|
char *confp = conf;
|
|
|
|
|
|
|
|
u_char *p;
|
|
|
|
ngx_str_t *value;
|
|
|
|
ngx_uint_t i, right, shift, *access;
|
|
|
|
|
|
|
|
access = (ngx_uint_t *) (confp + cmd->offset);
|
2007-07-13 16:30:34 +08:00
|
|
|
|
2007-07-12 19:19:05 +08:00
|
|
|
if (*access != NGX_CONF_UNSET_UINT) {
|
|
|
|
return "is duplicate";
|
|
|
|
}
|
2007-07-13 16:30:34 +08:00
|
|
|
|
2007-07-12 19:19:05 +08:00
|
|
|
value = cf->args->elts;
|
|
|
|
|
|
|
|
*access = 0600;
|
|
|
|
|
|
|
|
for (i = 1; i < cf->args->nelts; i++) {
|
|
|
|
|
|
|
|
p = value[i].data;
|
|
|
|
|
|
|
|
if (ngx_strncmp(p, "user:", sizeof("user:") - 1) == 0) {
|
|
|
|
shift = 6;
|
|
|
|
p += sizeof("user:") - 1;
|
|
|
|
|
|
|
|
} else if (ngx_strncmp(p, "group:", sizeof("group:") - 1) == 0) {
|
|
|
|
shift = 3;
|
|
|
|
p += sizeof("group:") - 1;
|
|
|
|
|
|
|
|
} else if (ngx_strncmp(p, "all:", sizeof("all:") - 1) == 0) {
|
|
|
|
shift = 0;
|
|
|
|
p += sizeof("all:") - 1;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
goto invalid;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ngx_strcmp(p, "rw") == 0) {
|
|
|
|
right = 6;
|
|
|
|
|
|
|
|
} else if (ngx_strcmp(p, "r") == 0) {
|
|
|
|
right = 4;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
goto invalid;
|
|
|
|
}
|
|
|
|
|
|
|
|
*access |= right << shift;
|
|
|
|
}
|
2007-07-13 16:30:34 +08:00
|
|
|
|
2007-07-12 19:19:05 +08:00
|
|
|
return NGX_CONF_OK;
|
|
|
|
|
|
|
|
invalid:
|
|
|
|
|
|
|
|
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, "invalid value \"%V\"", &value[i]);
|
|
|
|
|
|
|
|
return NGX_CONF_ERROR;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-02-22 22:40:13 +08:00
|
|
|
ngx_int_t
|
|
|
|
ngx_add_path(ngx_conf_t *cf, ngx_path_t **slot)
|
nginx-0.1.14-RELEASE import
*) Feature: the autoconfiguration directives:
--http-client-body-temp-path=PATH, --http-proxy-temp-path=PATH, and
--http-fastcgi-temp-path=PATH
*) Change: the directory name for the temporary files with the client
request body is specified by directive client_body_temp_path, by
default it is <prefix>/client_body_temp.
*) Feature: the ngx_http_fastcgi_module and the directives:
fastcgi_pass, fastcgi_root, fastcgi_index, fastcgi_params,
fastcgi_connect_timeout, fastcgi_send_timeout, fastcgi_read_timeout,
fastcgi_send_lowat, fastcgi_header_buffer_size, fastcgi_buffers,
fastcgi_busy_buffers_size, fastcgi_temp_path,
fastcgi_max_temp_file_size, fastcgi_temp_file_write_size,
fastcgi_next_upstream, and fastcgi_x_powered_by.
*) Bugfix: the "[alert] zero size buf" error; the bug had appeared in
0.1.3.
*) Change: the URI must be specified after the host name in the
proxy_pass directive.
*) Change: the %3F symbol in the URI was considered as the argument
string start.
*) Feature: the unix domain sockets support in the
ngx_http_proxy_module.
*) Feature: the ssl_engine and ssl_ciphers directives.
Thanks to Sergey Skvortsov for SSL-accelerator.
2005-01-18 21:03:58 +08:00
|
|
|
{
|
|
|
|
ngx_uint_t i, n;
|
|
|
|
ngx_path_t *path, **p;
|
2004-11-21 03:52:20 +08:00
|
|
|
|
nginx-0.1.14-RELEASE import
*) Feature: the autoconfiguration directives:
--http-client-body-temp-path=PATH, --http-proxy-temp-path=PATH, and
--http-fastcgi-temp-path=PATH
*) Change: the directory name for the temporary files with the client
request body is specified by directive client_body_temp_path, by
default it is <prefix>/client_body_temp.
*) Feature: the ngx_http_fastcgi_module and the directives:
fastcgi_pass, fastcgi_root, fastcgi_index, fastcgi_params,
fastcgi_connect_timeout, fastcgi_send_timeout, fastcgi_read_timeout,
fastcgi_send_lowat, fastcgi_header_buffer_size, fastcgi_buffers,
fastcgi_busy_buffers_size, fastcgi_temp_path,
fastcgi_max_temp_file_size, fastcgi_temp_file_write_size,
fastcgi_next_upstream, and fastcgi_x_powered_by.
*) Bugfix: the "[alert] zero size buf" error; the bug had appeared in
0.1.3.
*) Change: the URI must be specified after the host name in the
proxy_pass directive.
*) Change: the %3F symbol in the URI was considered as the argument
string start.
*) Feature: the unix domain sockets support in the
ngx_http_proxy_module.
*) Feature: the ssl_engine and ssl_ciphers directives.
Thanks to Sergey Skvortsov for SSL-accelerator.
2005-01-18 21:03:58 +08:00
|
|
|
path = *slot;
|
|
|
|
|
|
|
|
p = cf->cycle->pathes.elts;
|
2004-11-21 03:52:20 +08:00
|
|
|
for (i = 0; i < cf->cycle->pathes.nelts; i++) {
|
nginx-0.1.14-RELEASE import
*) Feature: the autoconfiguration directives:
--http-client-body-temp-path=PATH, --http-proxy-temp-path=PATH, and
--http-fastcgi-temp-path=PATH
*) Change: the directory name for the temporary files with the client
request body is specified by directive client_body_temp_path, by
default it is <prefix>/client_body_temp.
*) Feature: the ngx_http_fastcgi_module and the directives:
fastcgi_pass, fastcgi_root, fastcgi_index, fastcgi_params,
fastcgi_connect_timeout, fastcgi_send_timeout, fastcgi_read_timeout,
fastcgi_send_lowat, fastcgi_header_buffer_size, fastcgi_buffers,
fastcgi_busy_buffers_size, fastcgi_temp_path,
fastcgi_max_temp_file_size, fastcgi_temp_file_write_size,
fastcgi_next_upstream, and fastcgi_x_powered_by.
*) Bugfix: the "[alert] zero size buf" error; the bug had appeared in
0.1.3.
*) Change: the URI must be specified after the host name in the
proxy_pass directive.
*) Change: the %3F symbol in the URI was considered as the argument
string start.
*) Feature: the unix domain sockets support in the
ngx_http_proxy_module.
*) Feature: the ssl_engine and ssl_ciphers directives.
Thanks to Sergey Skvortsov for SSL-accelerator.
2005-01-18 21:03:58 +08:00
|
|
|
if (p[i]->name.len == path->name.len
|
|
|
|
&& ngx_strcmp(p[i]->name.data, path->name.data) == 0)
|
2004-11-21 03:52:20 +08:00
|
|
|
{
|
|
|
|
for (n = 0; n < 3; n++) {
|
nginx-0.1.14-RELEASE import
*) Feature: the autoconfiguration directives:
--http-client-body-temp-path=PATH, --http-proxy-temp-path=PATH, and
--http-fastcgi-temp-path=PATH
*) Change: the directory name for the temporary files with the client
request body is specified by directive client_body_temp_path, by
default it is <prefix>/client_body_temp.
*) Feature: the ngx_http_fastcgi_module and the directives:
fastcgi_pass, fastcgi_root, fastcgi_index, fastcgi_params,
fastcgi_connect_timeout, fastcgi_send_timeout, fastcgi_read_timeout,
fastcgi_send_lowat, fastcgi_header_buffer_size, fastcgi_buffers,
fastcgi_busy_buffers_size, fastcgi_temp_path,
fastcgi_max_temp_file_size, fastcgi_temp_file_write_size,
fastcgi_next_upstream, and fastcgi_x_powered_by.
*) Bugfix: the "[alert] zero size buf" error; the bug had appeared in
0.1.3.
*) Change: the URI must be specified after the host name in the
proxy_pass directive.
*) Change: the %3F symbol in the URI was considered as the argument
string start.
*) Feature: the unix domain sockets support in the
ngx_http_proxy_module.
*) Feature: the ssl_engine and ssl_ciphers directives.
Thanks to Sergey Skvortsov for SSL-accelerator.
2005-01-18 21:03:58 +08:00
|
|
|
if (p[i]->level[n] != path->level[n]) {
|
|
|
|
if (path->conf_file == NULL) {
|
2005-01-19 21:10:56 +08:00
|
|
|
if (p[i]->conf_file == NULL) {
|
|
|
|
ngx_log_error(NGX_LOG_EMERG, cf->log, 0,
|
|
|
|
"the default path name \"%V\" has "
|
|
|
|
"the same name as another default path, "
|
|
|
|
"but the different levels, you need to "
|
|
|
|
"redefine one of them in http section",
|
|
|
|
&p[i]->name);
|
|
|
|
return NGX_ERROR;
|
|
|
|
}
|
|
|
|
|
nginx-0.1.14-RELEASE import
*) Feature: the autoconfiguration directives:
--http-client-body-temp-path=PATH, --http-proxy-temp-path=PATH, and
--http-fastcgi-temp-path=PATH
*) Change: the directory name for the temporary files with the client
request body is specified by directive client_body_temp_path, by
default it is <prefix>/client_body_temp.
*) Feature: the ngx_http_fastcgi_module and the directives:
fastcgi_pass, fastcgi_root, fastcgi_index, fastcgi_params,
fastcgi_connect_timeout, fastcgi_send_timeout, fastcgi_read_timeout,
fastcgi_send_lowat, fastcgi_header_buffer_size, fastcgi_buffers,
fastcgi_busy_buffers_size, fastcgi_temp_path,
fastcgi_max_temp_file_size, fastcgi_temp_file_write_size,
fastcgi_next_upstream, and fastcgi_x_powered_by.
*) Bugfix: the "[alert] zero size buf" error; the bug had appeared in
0.1.3.
*) Change: the URI must be specified after the host name in the
proxy_pass directive.
*) Change: the %3F symbol in the URI was considered as the argument
string start.
*) Feature: the unix domain sockets support in the
ngx_http_proxy_module.
*) Feature: the ssl_engine and ssl_ciphers directives.
Thanks to Sergey Skvortsov for SSL-accelerator.
2005-01-18 21:03:58 +08:00
|
|
|
ngx_log_error(NGX_LOG_EMERG, cf->log, 0,
|
|
|
|
"the path name \"%V\" in %s:%ui has "
|
2005-01-19 21:10:56 +08:00
|
|
|
"the same name as default path, but "
|
nginx-0.1.14-RELEASE import
*) Feature: the autoconfiguration directives:
--http-client-body-temp-path=PATH, --http-proxy-temp-path=PATH, and
--http-fastcgi-temp-path=PATH
*) Change: the directory name for the temporary files with the client
request body is specified by directive client_body_temp_path, by
default it is <prefix>/client_body_temp.
*) Feature: the ngx_http_fastcgi_module and the directives:
fastcgi_pass, fastcgi_root, fastcgi_index, fastcgi_params,
fastcgi_connect_timeout, fastcgi_send_timeout, fastcgi_read_timeout,
fastcgi_send_lowat, fastcgi_header_buffer_size, fastcgi_buffers,
fastcgi_busy_buffers_size, fastcgi_temp_path,
fastcgi_max_temp_file_size, fastcgi_temp_file_write_size,
fastcgi_next_upstream, and fastcgi_x_powered_by.
*) Bugfix: the "[alert] zero size buf" error; the bug had appeared in
0.1.3.
*) Change: the URI must be specified after the host name in the
proxy_pass directive.
*) Change: the %3F symbol in the URI was considered as the argument
string start.
*) Feature: the unix domain sockets support in the
ngx_http_proxy_module.
*) Feature: the ssl_engine and ssl_ciphers directives.
Thanks to Sergey Skvortsov for SSL-accelerator.
2005-01-18 21:03:58 +08:00
|
|
|
"the different levels, you need to "
|
|
|
|
"define default path in http section",
|
|
|
|
&p[i]->name, p[i]->conf_file, p[i]->line);
|
|
|
|
return NGX_ERROR;
|
|
|
|
}
|
|
|
|
|
2004-11-21 03:52:20 +08:00
|
|
|
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
|
nginx-0.1.14-RELEASE import
*) Feature: the autoconfiguration directives:
--http-client-body-temp-path=PATH, --http-proxy-temp-path=PATH, and
--http-fastcgi-temp-path=PATH
*) Change: the directory name for the temporary files with the client
request body is specified by directive client_body_temp_path, by
default it is <prefix>/client_body_temp.
*) Feature: the ngx_http_fastcgi_module and the directives:
fastcgi_pass, fastcgi_root, fastcgi_index, fastcgi_params,
fastcgi_connect_timeout, fastcgi_send_timeout, fastcgi_read_timeout,
fastcgi_send_lowat, fastcgi_header_buffer_size, fastcgi_buffers,
fastcgi_busy_buffers_size, fastcgi_temp_path,
fastcgi_max_temp_file_size, fastcgi_temp_file_write_size,
fastcgi_next_upstream, and fastcgi_x_powered_by.
*) Bugfix: the "[alert] zero size buf" error; the bug had appeared in
0.1.3.
*) Change: the URI must be specified after the host name in the
proxy_pass directive.
*) Change: the %3F symbol in the URI was considered as the argument
string start.
*) Feature: the unix domain sockets support in the
ngx_http_proxy_module.
*) Feature: the ssl_engine and ssl_ciphers directives.
Thanks to Sergey Skvortsov for SSL-accelerator.
2005-01-18 21:03:58 +08:00
|
|
|
"the same path name \"%V\" in %s:%ui "
|
|
|
|
"has the different levels than",
|
|
|
|
&p[i]->name, p[i]->conf_file, p[i]->line);
|
|
|
|
return NGX_ERROR;
|
2004-11-21 03:52:20 +08:00
|
|
|
}
|
|
|
|
|
nginx-0.1.14-RELEASE import
*) Feature: the autoconfiguration directives:
--http-client-body-temp-path=PATH, --http-proxy-temp-path=PATH, and
--http-fastcgi-temp-path=PATH
*) Change: the directory name for the temporary files with the client
request body is specified by directive client_body_temp_path, by
default it is <prefix>/client_body_temp.
*) Feature: the ngx_http_fastcgi_module and the directives:
fastcgi_pass, fastcgi_root, fastcgi_index, fastcgi_params,
fastcgi_connect_timeout, fastcgi_send_timeout, fastcgi_read_timeout,
fastcgi_send_lowat, fastcgi_header_buffer_size, fastcgi_buffers,
fastcgi_busy_buffers_size, fastcgi_temp_path,
fastcgi_max_temp_file_size, fastcgi_temp_file_write_size,
fastcgi_next_upstream, and fastcgi_x_powered_by.
*) Bugfix: the "[alert] zero size buf" error; the bug had appeared in
0.1.3.
*) Change: the URI must be specified after the host name in the
proxy_pass directive.
*) Change: the %3F symbol in the URI was considered as the argument
string start.
*) Feature: the unix domain sockets support in the
ngx_http_proxy_module.
*) Feature: the ssl_engine and ssl_ciphers directives.
Thanks to Sergey Skvortsov for SSL-accelerator.
2005-01-18 21:03:58 +08:00
|
|
|
if (p[i]->level[n] == 0) {
|
2004-11-21 03:52:20 +08:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
nginx-0.1.14-RELEASE import
*) Feature: the autoconfiguration directives:
--http-client-body-temp-path=PATH, --http-proxy-temp-path=PATH, and
--http-fastcgi-temp-path=PATH
*) Change: the directory name for the temporary files with the client
request body is specified by directive client_body_temp_path, by
default it is <prefix>/client_body_temp.
*) Feature: the ngx_http_fastcgi_module and the directives:
fastcgi_pass, fastcgi_root, fastcgi_index, fastcgi_params,
fastcgi_connect_timeout, fastcgi_send_timeout, fastcgi_read_timeout,
fastcgi_send_lowat, fastcgi_header_buffer_size, fastcgi_buffers,
fastcgi_busy_buffers_size, fastcgi_temp_path,
fastcgi_max_temp_file_size, fastcgi_temp_file_write_size,
fastcgi_next_upstream, and fastcgi_x_powered_by.
*) Bugfix: the "[alert] zero size buf" error; the bug had appeared in
0.1.3.
*) Change: the URI must be specified after the host name in the
proxy_pass directive.
*) Change: the %3F symbol in the URI was considered as the argument
string start.
*) Feature: the unix domain sockets support in the
ngx_http_proxy_module.
*) Feature: the ssl_engine and ssl_ciphers directives.
Thanks to Sergey Skvortsov for SSL-accelerator.
2005-01-18 21:03:58 +08:00
|
|
|
*slot = p[i];
|
2004-11-21 03:52:20 +08:00
|
|
|
|
nginx-0.1.14-RELEASE import
*) Feature: the autoconfiguration directives:
--http-client-body-temp-path=PATH, --http-proxy-temp-path=PATH, and
--http-fastcgi-temp-path=PATH
*) Change: the directory name for the temporary files with the client
request body is specified by directive client_body_temp_path, by
default it is <prefix>/client_body_temp.
*) Feature: the ngx_http_fastcgi_module and the directives:
fastcgi_pass, fastcgi_root, fastcgi_index, fastcgi_params,
fastcgi_connect_timeout, fastcgi_send_timeout, fastcgi_read_timeout,
fastcgi_send_lowat, fastcgi_header_buffer_size, fastcgi_buffers,
fastcgi_busy_buffers_size, fastcgi_temp_path,
fastcgi_max_temp_file_size, fastcgi_temp_file_write_size,
fastcgi_next_upstream, and fastcgi_x_powered_by.
*) Bugfix: the "[alert] zero size buf" error; the bug had appeared in
0.1.3.
*) Change: the URI must be specified after the host name in the
proxy_pass directive.
*) Change: the %3F symbol in the URI was considered as the argument
string start.
*) Feature: the unix domain sockets support in the
ngx_http_proxy_module.
*) Feature: the ssl_engine and ssl_ciphers directives.
Thanks to Sergey Skvortsov for SSL-accelerator.
2005-01-18 21:03:58 +08:00
|
|
|
return NGX_OK;
|
2004-11-21 03:52:20 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-03-19 20:38:37 +08:00
|
|
|
p = ngx_array_push(&cf->cycle->pathes);
|
|
|
|
if (p == NULL) {
|
nginx-0.1.14-RELEASE import
*) Feature: the autoconfiguration directives:
--http-client-body-temp-path=PATH, --http-proxy-temp-path=PATH, and
--http-fastcgi-temp-path=PATH
*) Change: the directory name for the temporary files with the client
request body is specified by directive client_body_temp_path, by
default it is <prefix>/client_body_temp.
*) Feature: the ngx_http_fastcgi_module and the directives:
fastcgi_pass, fastcgi_root, fastcgi_index, fastcgi_params,
fastcgi_connect_timeout, fastcgi_send_timeout, fastcgi_read_timeout,
fastcgi_send_lowat, fastcgi_header_buffer_size, fastcgi_buffers,
fastcgi_busy_buffers_size, fastcgi_temp_path,
fastcgi_max_temp_file_size, fastcgi_temp_file_write_size,
fastcgi_next_upstream, and fastcgi_x_powered_by.
*) Bugfix: the "[alert] zero size buf" error; the bug had appeared in
0.1.3.
*) Change: the URI must be specified after the host name in the
proxy_pass directive.
*) Change: the %3F symbol in the URI was considered as the argument
string start.
*) Feature: the unix domain sockets support in the
ngx_http_proxy_module.
*) Feature: the ssl_engine and ssl_ciphers directives.
Thanks to Sergey Skvortsov for SSL-accelerator.
2005-01-18 21:03:58 +08:00
|
|
|
return NGX_ERROR;
|
2004-11-21 03:52:20 +08:00
|
|
|
}
|
|
|
|
|
nginx-0.1.14-RELEASE import
*) Feature: the autoconfiguration directives:
--http-client-body-temp-path=PATH, --http-proxy-temp-path=PATH, and
--http-fastcgi-temp-path=PATH
*) Change: the directory name for the temporary files with the client
request body is specified by directive client_body_temp_path, by
default it is <prefix>/client_body_temp.
*) Feature: the ngx_http_fastcgi_module and the directives:
fastcgi_pass, fastcgi_root, fastcgi_index, fastcgi_params,
fastcgi_connect_timeout, fastcgi_send_timeout, fastcgi_read_timeout,
fastcgi_send_lowat, fastcgi_header_buffer_size, fastcgi_buffers,
fastcgi_busy_buffers_size, fastcgi_temp_path,
fastcgi_max_temp_file_size, fastcgi_temp_file_write_size,
fastcgi_next_upstream, and fastcgi_x_powered_by.
*) Bugfix: the "[alert] zero size buf" error; the bug had appeared in
0.1.3.
*) Change: the URI must be specified after the host name in the
proxy_pass directive.
*) Change: the %3F symbol in the URI was considered as the argument
string start.
*) Feature: the unix domain sockets support in the
ngx_http_proxy_module.
*) Feature: the ssl_engine and ssl_ciphers directives.
Thanks to Sergey Skvortsov for SSL-accelerator.
2005-01-18 21:03:58 +08:00
|
|
|
*p = path;
|
2003-11-19 05:34:08 +08:00
|
|
|
|
nginx-0.1.14-RELEASE import
*) Feature: the autoconfiguration directives:
--http-client-body-temp-path=PATH, --http-proxy-temp-path=PATH, and
--http-fastcgi-temp-path=PATH
*) Change: the directory name for the temporary files with the client
request body is specified by directive client_body_temp_path, by
default it is <prefix>/client_body_temp.
*) Feature: the ngx_http_fastcgi_module and the directives:
fastcgi_pass, fastcgi_root, fastcgi_index, fastcgi_params,
fastcgi_connect_timeout, fastcgi_send_timeout, fastcgi_read_timeout,
fastcgi_send_lowat, fastcgi_header_buffer_size, fastcgi_buffers,
fastcgi_busy_buffers_size, fastcgi_temp_path,
fastcgi_max_temp_file_size, fastcgi_temp_file_write_size,
fastcgi_next_upstream, and fastcgi_x_powered_by.
*) Bugfix: the "[alert] zero size buf" error; the bug had appeared in
0.1.3.
*) Change: the URI must be specified after the host name in the
proxy_pass directive.
*) Change: the %3F symbol in the URI was considered as the argument
string start.
*) Feature: the unix domain sockets support in the
ngx_http_proxy_module.
*) Feature: the ssl_engine and ssl_ciphers directives.
Thanks to Sergey Skvortsov for SSL-accelerator.
2005-01-18 21:03:58 +08:00
|
|
|
return NGX_OK;
|
2003-10-23 00:38:26 +08:00
|
|
|
}
|
2004-11-21 03:52:20 +08:00
|
|
|
|
|
|
|
|
2005-02-22 22:40:13 +08:00
|
|
|
ngx_int_t
|
|
|
|
ngx_create_pathes(ngx_cycle_t *cycle, ngx_uid_t user)
|
2004-11-21 03:52:20 +08:00
|
|
|
{
|
|
|
|
ngx_err_t err;
|
|
|
|
ngx_uint_t i;
|
|
|
|
ngx_path_t **path;
|
|
|
|
#if !(NGX_WIN32)
|
|
|
|
ngx_file_info_t fi;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
path = cycle->pathes.elts;
|
|
|
|
for (i = 0; i < cycle->pathes.nelts; i++) {
|
|
|
|
|
2006-08-05 00:04:04 +08:00
|
|
|
if (ngx_create_dir(path[i]->name.data, 0700) == NGX_FILE_ERROR) {
|
2004-11-21 03:52:20 +08:00
|
|
|
err = ngx_errno;
|
|
|
|
if (err != NGX_EEXIST) {
|
|
|
|
ngx_log_error(NGX_LOG_EMERG, cycle->log, err,
|
|
|
|
ngx_create_dir_n " \"%s\" failed",
|
|
|
|
path[i]->name.data);
|
|
|
|
return NGX_ERROR;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-05-23 20:07:45 +08:00
|
|
|
if (user == (ngx_uid_t) NGX_CONF_UNSET_UINT) {
|
2004-11-21 03:52:20 +08:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
#if !(NGX_WIN32)
|
|
|
|
|
|
|
|
if (ngx_file_info((const char *) path[i]->name.data, &fi) == -1) {
|
|
|
|
ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno,
|
|
|
|
ngx_file_info_n " \"%s\" failed", path[i]->name.data);
|
|
|
|
return NGX_ERROR;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (fi.st_uid != user) {
|
|
|
|
if (chown((const char *) path[i]->name.data, user, -1) == -1) {
|
|
|
|
ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno,
|
|
|
|
"chown(\"%s\", %d) failed",
|
|
|
|
path[i]->name.data, user);
|
|
|
|
return NGX_ERROR;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((fi.st_mode & (S_IRUSR|S_IWUSR|S_IXUSR))
|
|
|
|
!= (S_IRUSR|S_IWUSR|S_IXUSR))
|
|
|
|
{
|
|
|
|
fi.st_mode |= (S_IRUSR|S_IWUSR|S_IXUSR);
|
|
|
|
|
|
|
|
if (chmod((const char *) path[i]->name.data, fi.st_mode) == -1) {
|
|
|
|
ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno,
|
|
|
|
"chmod() \"%s\" failed", path[i]->name.data);
|
|
|
|
return NGX_ERROR;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
return NGX_OK;
|
|
|
|
}
|
2006-12-25 20:38:00 +08:00
|
|
|
|
|
|
|
|
|
|
|
ngx_int_t
|
|
|
|
ngx_walk_tree(ngx_tree_ctx_t *ctx, ngx_str_t *tree)
|
|
|
|
{
|
|
|
|
void *data, *prev;
|
|
|
|
u_char *p, *name;
|
|
|
|
size_t len;
|
|
|
|
ngx_int_t rc;
|
|
|
|
ngx_err_t err;
|
2007-01-04 02:12:32 +08:00
|
|
|
ngx_str_t file, buf;
|
2006-12-25 20:38:00 +08:00
|
|
|
ngx_dir_t dir;
|
|
|
|
|
|
|
|
buf.len = 0;
|
|
|
|
buf.data = NULL;
|
|
|
|
|
|
|
|
ngx_log_debug1(NGX_LOG_DEBUG_CORE, ctx->log, 0,
|
|
|
|
"walk tree \"%V\"", tree);
|
|
|
|
|
|
|
|
if (ngx_open_dir(tree, &dir) == NGX_ERROR) {
|
|
|
|
ngx_log_error(NGX_LOG_CRIT, ctx->log, ngx_errno,
|
|
|
|
ngx_open_dir_n " \"%s\" failed", tree->data);
|
|
|
|
return NGX_ERROR;
|
|
|
|
}
|
|
|
|
|
|
|
|
prev = ctx->data;
|
|
|
|
|
2007-01-19 05:04:31 +08:00
|
|
|
if (ctx->alloc) {
|
|
|
|
data = ngx_alloc(ctx->alloc, ctx->log);
|
2006-12-25 20:38:00 +08:00
|
|
|
if (data == NULL) {
|
|
|
|
goto failed;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ctx->init_handler(data, prev) == NGX_ABORT) {
|
|
|
|
goto failed;
|
|
|
|
}
|
|
|
|
|
|
|
|
ctx->data = data;
|
2007-07-20 03:11:57 +08:00
|
|
|
|
|
|
|
} else {
|
|
|
|
data = NULL;
|
2006-12-25 20:38:00 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
for ( ;; ) {
|
|
|
|
|
|
|
|
ngx_set_errno(0);
|
|
|
|
|
|
|
|
if (ngx_read_dir(&dir) == NGX_ERROR) {
|
|
|
|
err = ngx_errno;
|
|
|
|
|
|
|
|
if (err == NGX_ENOMOREFILES) {
|
|
|
|
rc = NGX_OK;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
ngx_log_error(NGX_LOG_CRIT, ctx->log, err,
|
|
|
|
ngx_read_dir_n " \"%s\" failed", tree->data);
|
|
|
|
rc = NGX_ERROR;
|
|
|
|
}
|
|
|
|
|
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
|
|
|
|
len = ngx_de_namelen(&dir);
|
|
|
|
name = ngx_de_name(&dir);
|
|
|
|
|
|
|
|
ngx_log_debug2(NGX_LOG_DEBUG_CORE, ctx->log, 0,
|
|
|
|
"tree name %uz:\"%s\"", len, name);
|
|
|
|
|
|
|
|
if (len == 1 && name[0] == '.') {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (len == 2 && name[0] == '.' && name[1] == '.') {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
file.len = tree->len + 1 + len;
|
|
|
|
|
|
|
|
if (file.len + NGX_DIR_MASK_LEN > buf.len) {
|
|
|
|
|
|
|
|
if (buf.len) {
|
|
|
|
ngx_free(buf.data);
|
|
|
|
}
|
|
|
|
|
|
|
|
buf.len = tree->len + 1 + len + NGX_DIR_MASK_LEN;
|
|
|
|
|
|
|
|
buf.data = ngx_alloc(buf.len + 1, ctx->log);
|
|
|
|
if (buf.data == NULL) {
|
|
|
|
goto failed;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
p = ngx_cpymem(buf.data, tree->data, tree->len);
|
|
|
|
*p++ = '/';
|
|
|
|
ngx_memcpy(p, name, len + 1);
|
|
|
|
|
|
|
|
file.data = buf.data;
|
|
|
|
|
|
|
|
ngx_log_debug1(NGX_LOG_DEBUG_CORE, ctx->log, 0,
|
|
|
|
"tree path \"%s\"", file.data);
|
|
|
|
|
|
|
|
if (!dir.valid_info) {
|
|
|
|
if (ngx_de_info(file.data, &dir) == NGX_FILE_ERROR) {
|
|
|
|
ngx_log_error(NGX_LOG_CRIT, ctx->log, ngx_errno,
|
|
|
|
ngx_de_info_n " \"%s\" failed", file.data);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ngx_de_is_file(&dir)) {
|
|
|
|
|
|
|
|
ngx_log_debug1(NGX_LOG_DEBUG_CORE, ctx->log, 0,
|
|
|
|
"tree file \"%s\"", file.data);
|
|
|
|
|
2007-01-19 05:04:31 +08:00
|
|
|
ctx->size = ngx_de_size(&dir);
|
|
|
|
ctx->access = ngx_de_access(&dir);
|
|
|
|
ctx->mtime = ngx_de_mtime(&dir);
|
|
|
|
|
2006-12-25 20:38:00 +08:00
|
|
|
if (ctx->file_handler(ctx, &file) == NGX_ABORT) {
|
|
|
|
goto failed;
|
|
|
|
}
|
|
|
|
|
|
|
|
} else if (ngx_de_is_dir(&dir)) {
|
|
|
|
|
|
|
|
ngx_log_debug1(NGX_LOG_DEBUG_CORE, ctx->log, 0,
|
|
|
|
"tree enter dir \"%s\"", file.data);
|
|
|
|
|
2007-01-19 05:04:31 +08:00
|
|
|
ctx->access = ngx_de_access(&dir);
|
|
|
|
ctx->mtime = ngx_de_mtime(&dir);
|
|
|
|
|
2006-12-25 20:38:00 +08:00
|
|
|
if (ctx->pre_tree_handler(ctx, &file) == NGX_ABORT) {
|
|
|
|
goto failed;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ngx_walk_tree(ctx, &file) == NGX_ABORT) {
|
|
|
|
goto failed;
|
|
|
|
}
|
|
|
|
|
2007-01-19 05:04:31 +08:00
|
|
|
ctx->access = ngx_de_access(&dir);
|
|
|
|
ctx->mtime = ngx_de_mtime(&dir);
|
|
|
|
|
2006-12-25 20:38:00 +08:00
|
|
|
if (ctx->post_tree_handler(ctx, &file) == NGX_ABORT) {
|
|
|
|
goto failed;
|
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
ngx_log_debug1(NGX_LOG_DEBUG_CORE, ctx->log, 0,
|
|
|
|
"tree special \"%s\"", file.data);
|
|
|
|
|
|
|
|
if (ctx->spec_handler(ctx, &file) == NGX_ABORT) {
|
|
|
|
goto failed;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
failed:
|
|
|
|
|
|
|
|
rc = NGX_ABORT;
|
|
|
|
|
|
|
|
done:
|
|
|
|
|
|
|
|
if (buf.len) {
|
|
|
|
ngx_free(buf.data);
|
|
|
|
}
|
|
|
|
|
2007-07-20 03:11:57 +08:00
|
|
|
if (data) {
|
|
|
|
ngx_free(data);
|
2006-12-25 20:38:00 +08:00
|
|
|
ctx->data = prev;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ngx_close_dir(&dir) == NGX_ERROR) {
|
|
|
|
ngx_log_error(NGX_LOG_CRIT, ctx->log, ngx_errno,
|
|
|
|
ngx_close_dir_n " \"%s\" failed", tree->data);
|
|
|
|
}
|
|
|
|
|
|
|
|
return rc;
|
|
|
|
}
|