2002-08-07 00:39:45 +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
|
|
|
*/
|
|
|
|
|
|
|
|
|
2002-08-07 00:39:45 +08:00
|
|
|
#include <ngx_config.h>
|
2003-06-03 23:42:58 +08:00
|
|
|
#include <ngx_core.h>
|
2002-08-07 00:39:45 +08:00
|
|
|
|
|
|
|
|
2005-03-19 20:38:37 +08:00
|
|
|
ngx_pool_t *
|
|
|
|
ngx_create_pool(size_t size, ngx_log_t *log)
|
2002-08-07 00:39:45 +08:00
|
|
|
{
|
2003-11-21 14:30:49 +08:00
|
|
|
ngx_pool_t *p;
|
2002-08-07 00:39:45 +08:00
|
|
|
|
2005-03-19 20:38:37 +08:00
|
|
|
p = ngx_alloc(size, log);
|
|
|
|
if (p == NULL) {
|
2005-07-08 22:34:20 +08:00
|
|
|
return NULL;
|
2003-11-21 14:30:49 +08:00
|
|
|
}
|
2002-08-07 00:39:45 +08:00
|
|
|
|
2005-02-04 03:33:37 +08:00
|
|
|
p->last = (u_char *) p + sizeof(ngx_pool_t);
|
|
|
|
p->end = (u_char *) p + size;
|
2005-11-26 18:11:11 +08:00
|
|
|
p->current = p;
|
|
|
|
p->chain = NULL;
|
2002-08-07 00:39:45 +08:00
|
|
|
p->next = NULL;
|
|
|
|
p->large = 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
|
|
|
p->cleanup = NULL;
|
2002-08-07 00:39:45 +08:00
|
|
|
p->log = log;
|
|
|
|
|
|
|
|
return p;
|
|
|
|
}
|
|
|
|
|
2003-10-23 14:13:16 +08:00
|
|
|
|
2005-03-19 20:38:37 +08:00
|
|
|
void
|
|
|
|
ngx_destroy_pool(ngx_pool_t *pool)
|
2002-08-07 00:39:45 +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
|
|
|
ngx_pool_t *p, *n;
|
|
|
|
ngx_pool_large_t *l;
|
|
|
|
ngx_pool_cleanup_t *c;
|
|
|
|
|
|
|
|
for (c = pool->cleanup; c; c = c->next) {
|
|
|
|
if (c->handler) {
|
2007-12-18 01:29:36 +08:00
|
|
|
ngx_log_debug1(NGX_LOG_DEBUG_ALLOC, pool->log, 0,
|
|
|
|
"run cleanup: %p", c);
|
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
|
|
|
c->handler(c->data);
|
|
|
|
}
|
|
|
|
}
|
2002-08-07 00:39:45 +08:00
|
|
|
|
2002-09-11 23:18:33 +08:00
|
|
|
for (l = pool->large; l; l = l->next) {
|
2004-02-12 01:08:49 +08:00
|
|
|
|
2004-11-11 22:07:14 +08:00
|
|
|
ngx_log_debug1(NGX_LOG_DEBUG_ALLOC, pool->log, 0, "free: %p", l->alloc);
|
2004-02-12 01:08:49 +08:00
|
|
|
|
2003-10-23 14:13:16 +08:00
|
|
|
if (l->alloc) {
|
2004-12-21 20:30:30 +08:00
|
|
|
ngx_free(l->alloc);
|
2003-10-23 14:13:16 +08:00
|
|
|
}
|
2002-09-11 23:18:33 +08:00
|
|
|
}
|
2002-08-07 00:39:45 +08:00
|
|
|
|
2004-02-12 01:08:49 +08:00
|
|
|
#if (NGX_DEBUG)
|
|
|
|
|
2003-08-08 23:13:24 +08:00
|
|
|
/*
|
2004-02-12 01:08:49 +08:00
|
|
|
* we could allocate the pool->log from this pool
|
|
|
|
* so we can not use this log while the free()ing the pool
|
2003-08-08 23:13:24 +08:00
|
|
|
*/
|
2003-08-06 22:43:50 +08:00
|
|
|
|
2003-08-08 23:13:24 +08:00
|
|
|
for (p = pool, n = pool->next; /* void */; p = n, n = n->next) {
|
2004-09-23 14:32:00 +08:00
|
|
|
ngx_log_debug2(NGX_LOG_DEBUG_ALLOC, pool->log, 0,
|
2004-11-11 22:07:14 +08:00
|
|
|
"free: %p, unused: %uz", p, p->end - p->last);
|
2003-09-25 03:51:12 +08:00
|
|
|
|
|
|
|
if (n == NULL) {
|
|
|
|
break;
|
|
|
|
}
|
2003-08-08 23:13:24 +08:00
|
|
|
}
|
2004-02-12 01:08:49 +08:00
|
|
|
|
2002-12-25 01:30:59 +08:00
|
|
|
#endif
|
2003-08-08 23:13:24 +08:00
|
|
|
|
|
|
|
for (p = pool, n = pool->next; /* void */; p = n, n = n->next) {
|
2004-12-21 20:30:30 +08:00
|
|
|
ngx_free(p);
|
2003-08-08 23:13:24 +08:00
|
|
|
|
|
|
|
if (n == NULL) {
|
|
|
|
break;
|
|
|
|
}
|
2002-08-07 00:39:45 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-10-23 14:13:16 +08:00
|
|
|
|
2005-03-19 20:38:37 +08:00
|
|
|
void *
|
|
|
|
ngx_palloc(ngx_pool_t *pool, size_t size)
|
2002-08-07 00:39:45 +08:00
|
|
|
{
|
2005-02-04 03:33:37 +08:00
|
|
|
u_char *m;
|
2006-12-19 04:46:49 +08:00
|
|
|
ngx_pool_t *p, *n, *current;
|
2006-04-05 21:40:54 +08:00
|
|
|
ngx_pool_large_t *large;
|
2002-08-07 00:39:45 +08:00
|
|
|
|
2004-09-18 00:07:35 +08:00
|
|
|
if (size <= (size_t) NGX_MAX_ALLOC_FROM_POOL
|
2005-02-04 03:33:37 +08:00
|
|
|
&& size <= (size_t) (pool->end - (u_char *) pool)
|
2005-12-16 23:07:08 +08:00
|
|
|
- (size_t) ngx_align_ptr(sizeof(ngx_pool_t), NGX_ALIGNMENT))
|
2004-09-18 00:07:35 +08:00
|
|
|
{
|
2006-12-19 04:46:49 +08:00
|
|
|
p = pool->current;
|
|
|
|
current = p;
|
|
|
|
|
|
|
|
for ( ;; ) {
|
2005-12-16 23:07:08 +08:00
|
|
|
|
2007-05-21 21:49:35 +08:00
|
|
|
#if (NGX_HAVE_NONALIGNED)
|
|
|
|
|
|
|
|
/*
|
|
|
|
* allow non-aligned memory blocks for small allocations (1, 2,
|
|
|
|
* or 3 bytes) and for odd length strings (struct's have aligned
|
|
|
|
* size)
|
|
|
|
*/
|
|
|
|
|
2005-12-16 23:07:08 +08:00
|
|
|
if (size < sizeof(int) || (size & 1)) {
|
|
|
|
m = p->last;
|
|
|
|
|
2007-05-21 21:49:35 +08:00
|
|
|
} else
|
|
|
|
#endif
|
|
|
|
|
|
|
|
{
|
2005-12-16 23:07:08 +08:00
|
|
|
m = ngx_align_ptr(p->last, NGX_ALIGNMENT);
|
|
|
|
}
|
2003-06-12 13:54:39 +08:00
|
|
|
|
|
|
|
if ((size_t) (p->end - m) >= size) {
|
2004-10-11 23:07:03 +08:00
|
|
|
p->last = m + size;
|
2002-08-07 00:39:45 +08:00
|
|
|
|
|
|
|
return m;
|
|
|
|
}
|
|
|
|
|
2005-11-26 18:11:11 +08:00
|
|
|
if ((size_t) (p->end - m) < NGX_ALIGNMENT) {
|
2006-12-19 04:46:49 +08:00
|
|
|
current = p->next;
|
2005-11-26 18:11:11 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
if (p->next == NULL) {
|
2002-08-07 00:39:45 +08:00
|
|
|
break;
|
2002-12-25 01:30:59 +08:00
|
|
|
}
|
2006-12-19 04:46:49 +08:00
|
|
|
|
|
|
|
p = p->next;
|
|
|
|
pool->current = current;
|
2002-08-07 00:39:45 +08:00
|
|
|
}
|
|
|
|
|
2004-09-15 03:39:54 +08:00
|
|
|
/* allocate a new pool block */
|
2003-10-23 14:13:16 +08:00
|
|
|
|
2005-03-19 20:38:37 +08:00
|
|
|
n = ngx_create_pool((size_t) (p->end - (u_char *) p), p->log);
|
|
|
|
if (n == NULL) {
|
2003-11-21 14:30:49 +08:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2006-12-19 04:46:49 +08:00
|
|
|
pool->current = current ? current : n;
|
2005-11-26 18:11:11 +08:00
|
|
|
|
2002-08-07 00:39:45 +08:00
|
|
|
p->next = n;
|
2005-12-16 23:07:08 +08:00
|
|
|
m = ngx_align_ptr(n->last, NGX_ALIGNMENT);
|
2004-10-11 23:07:03 +08:00
|
|
|
n->last = m + size;
|
2003-10-23 14:13:16 +08:00
|
|
|
|
2002-08-07 00:39:45 +08:00
|
|
|
return m;
|
2003-10-23 14:13:16 +08:00
|
|
|
}
|
2002-08-07 00:39:45 +08:00
|
|
|
|
2004-06-09 00:26:37 +08:00
|
|
|
#if 0
|
2005-03-19 20:38:37 +08:00
|
|
|
p = ngx_memalign(ngx_pagesize, size, pool->log);
|
|
|
|
if (p == NULL) {
|
2003-11-21 14:30:49 +08:00
|
|
|
return NULL;
|
|
|
|
}
|
2004-06-09 00:26:37 +08:00
|
|
|
#else
|
2005-03-19 20:38:37 +08:00
|
|
|
p = ngx_alloc(size, pool->log);
|
|
|
|
if (p == NULL) {
|
2004-06-09 00:26:37 +08:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
#endif
|
2002-08-07 00:39:45 +08:00
|
|
|
|
2006-04-05 21:40:54 +08:00
|
|
|
large = ngx_palloc(pool, sizeof(ngx_pool_large_t));
|
|
|
|
if (large == NULL) {
|
2007-07-20 03:07:13 +08:00
|
|
|
ngx_free(p);
|
2006-04-05 21:40:54 +08:00
|
|
|
return NULL;
|
2003-10-23 14:13:16 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
large->alloc = p;
|
2006-04-05 21:40:54 +08:00
|
|
|
large->next = pool->large;
|
|
|
|
pool->large = large;
|
2002-08-07 00:39:45 +08:00
|
|
|
|
2003-10-23 14:13:16 +08:00
|
|
|
return p;
|
|
|
|
}
|
2002-08-07 00:39:45 +08:00
|
|
|
|
2003-10-23 14:13:16 +08:00
|
|
|
|
2005-03-19 20:38:37 +08:00
|
|
|
ngx_int_t
|
|
|
|
ngx_pfree(ngx_pool_t *pool, void *p)
|
2003-10-23 14:13:16 +08:00
|
|
|
{
|
|
|
|
ngx_pool_large_t *l;
|
|
|
|
|
|
|
|
for (l = pool->large; l; l = l->next) {
|
|
|
|
if (p == l->alloc) {
|
2004-02-12 01:08:49 +08:00
|
|
|
ngx_log_debug1(NGX_LOG_DEBUG_ALLOC, pool->log, 0,
|
2004-11-11 22:07:14 +08:00
|
|
|
"free: %p", l->alloc);
|
2004-12-21 20:30:30 +08:00
|
|
|
ngx_free(l->alloc);
|
2003-10-23 14:13:16 +08:00
|
|
|
l->alloc = NULL;
|
2004-09-23 14:32:00 +08:00
|
|
|
|
|
|
|
return NGX_OK;
|
2003-10-23 14:13:16 +08:00
|
|
|
}
|
2002-08-07 00:39:45 +08:00
|
|
|
}
|
2004-09-23 14:32:00 +08:00
|
|
|
|
|
|
|
return NGX_DECLINED;
|
2002-08-07 00:39:45 +08:00
|
|
|
}
|
|
|
|
|
2003-10-23 14:13:16 +08:00
|
|
|
|
2005-03-19 20:38:37 +08:00
|
|
|
void *
|
|
|
|
ngx_pcalloc(ngx_pool_t *pool, size_t size)
|
2002-08-07 00:39:45 +08:00
|
|
|
{
|
|
|
|
void *p;
|
|
|
|
|
|
|
|
p = ngx_palloc(pool, size);
|
2002-12-25 01:30:59 +08:00
|
|
|
if (p) {
|
2002-08-07 00:39:45 +08:00
|
|
|
ngx_memzero(p, size);
|
2002-12-25 01:30:59 +08:00
|
|
|
}
|
2002-08-07 00:39:45 +08:00
|
|
|
|
|
|
|
return p;
|
|
|
|
}
|
2004-06-07 03:49:18 +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
|
|
|
|
|
|
|
ngx_pool_cleanup_t *
|
2005-10-19 20:33:58 +08:00
|
|
|
ngx_pool_cleanup_add(ngx_pool_t *p, size_t size)
|
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_pool_cleanup_t *c;
|
|
|
|
|
|
|
|
c = ngx_palloc(p, sizeof(ngx_pool_cleanup_t));
|
|
|
|
if (c == NULL) {
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2005-10-19 20:33:58 +08:00
|
|
|
if (size) {
|
|
|
|
c->data = ngx_palloc(p, size);
|
|
|
|
if (c->data == NULL) {
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
|
|
c->data = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
c->handler = 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
|
|
|
c->next = p->cleanup;
|
|
|
|
|
|
|
|
p->cleanup = c;
|
|
|
|
|
2005-10-19 20:33:58 +08:00
|
|
|
ngx_log_debug1(NGX_LOG_DEBUG_ALLOC, p->log, 0, "add cleanup: %p", c);
|
|
|
|
|
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 c;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
ngx_pool_cleanup_file(void *data)
|
|
|
|
{
|
|
|
|
ngx_pool_cleanup_file_t *c = data;
|
|
|
|
|
2007-12-18 01:29:36 +08:00
|
|
|
ngx_log_debug1(NGX_LOG_DEBUG_ALLOC, c->log, 0, "file cleanup: fd:%d",
|
|
|
|
c->fd);
|
2005-10-19 20:33:58 +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 (ngx_close_file(c->fd) == NGX_FILE_ERROR) {
|
|
|
|
ngx_log_error(NGX_LOG_ALERT, c->log, ngx_errno,
|
|
|
|
ngx_close_file_n " \"%s\" failed", c->name);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-01-25 16:45:04 +08:00
|
|
|
void
|
|
|
|
ngx_pool_delete_file(void *data)
|
|
|
|
{
|
|
|
|
ngx_pool_cleanup_file_t *c = data;
|
|
|
|
|
|
|
|
ngx_err_t err;
|
|
|
|
|
2007-12-18 01:29:36 +08:00
|
|
|
ngx_log_debug2(NGX_LOG_DEBUG_ALLOC, c->log, 0, "file cleanup: fd:%d %s",
|
|
|
|
c->fd, c->name);
|
2007-01-25 16:45:04 +08:00
|
|
|
|
|
|
|
if (ngx_delete_file(c->name) == NGX_FILE_ERROR) {
|
|
|
|
err = ngx_errno;
|
|
|
|
|
|
|
|
if (err != NGX_ENOENT) {
|
|
|
|
ngx_log_error(NGX_LOG_CRIT, c->log, err,
|
|
|
|
ngx_delete_file_n " \"%s\" failed", c->name);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ngx_close_file(c->fd) == NGX_FILE_ERROR) {
|
|
|
|
ngx_log_error(NGX_LOG_ALERT, c->log, ngx_errno,
|
|
|
|
ngx_close_file_n " \"%s\" failed", c->name);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-06-07 03:49:18 +08:00
|
|
|
#if 0
|
|
|
|
|
2005-03-19 20:38:37 +08:00
|
|
|
static void *
|
|
|
|
ngx_get_cached_block(size_t size)
|
2004-06-07 03:49:18 +08:00
|
|
|
{
|
|
|
|
void *p;
|
|
|
|
ngx_cached_block_slot_t *slot;
|
|
|
|
|
|
|
|
if (ngx_cycle->cache == NULL) {
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
slot = &ngx_cycle->cache[(size + ngx_pagesize - 1) / ngx_pagesize];
|
|
|
|
|
|
|
|
slot->tries++;
|
|
|
|
|
|
|
|
if (slot->number) {
|
|
|
|
p = slot->block;
|
|
|
|
slot->block = slot->block->next;
|
|
|
|
slot->number--;
|
|
|
|
return p;
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|