Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nginx/nginx.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2005-11-26 13:11:11 +0300
committerIgor Sysoev <igor@sysoev.ru>2005-11-26 13:11:11 +0300
commitc31a9bb5e336b15f48c875e1f448f71d68f3feb9 (patch)
tree31ae2b332d1b263c858bab6ee4c21778403f181d /src/core
parent99d9a4b4c547800d582a96871416797fb446b02b (diff)
nginx-0.3.12-RELEASE importrelease-0.3.12
*) Security: if nginx was built with the ngx_http_realip_module and the "satisfy_any on" directive was used, then access and authorization directives did not work. The ngx_http_realip_module was not built and is not built by default. *) Change: the "$time_gmt" variable name was changed to "$time_local". *) Change: the "proxy_header_buffer_size" and "fastcgi_header_buffer_size" directives was renamed to the "proxy_buffer_size" and "fastcgi_buffer_size" directives. *) Feature: the ngx_http_memcached_module. *) Feature: the "proxy_buffering" directive. *) Bugfix: the changes in accept mutex handling when the "rtsig" method was used; the bug had appeared in 0.3.0. *) Bugfix: if the client sent the "Transfer-Encoding: chunked" header line, then nginx returns the 411 error. *) Bugfix: if the "auth_basic" directive was inherited from the http level, then the realm in the "WWW-Authenticate" header line was without the "Basic realm" text. *) Bugfix: if the "combined" format was explicitly specified in the "access_log" directive, then the empty lines was written to the log; the bug had appeared in 0.3.8. *) Bugfix: nginx did not run on the sparc platform under any OS except Solaris. *) Bugfix: now it is not necessary to place space between the quoted string and closing bracket in the "if" directive.
Diffstat (limited to 'src/core')
-rw-r--r--src/core/nginx.h2
-rw-r--r--src/core/ngx_buf.c28
-rw-r--r--src/core/ngx_buf.h1
-rw-r--r--src/core/ngx_conf_file.c34
-rw-r--r--src/core/ngx_conf_file.h9
-rw-r--r--src/core/ngx_config.h32
-rw-r--r--src/core/ngx_inet.c4
-rw-r--r--src/core/ngx_palloc.c15
-rw-r--r--src/core/ngx_palloc.h1
9 files changed, 96 insertions, 30 deletions
diff --git a/src/core/nginx.h b/src/core/nginx.h
index 95d93ccb2..44b15f9f2 100644
--- a/src/core/nginx.h
+++ b/src/core/nginx.h
@@ -8,7 +8,7 @@
#define _NGINX_H_INCLUDED_
-#define NGINX_VER "nginx/0.3.11"
+#define NGINX_VER "nginx/0.3.12"
#define NGINX_VAR "NGINX"
#define NGX_OLDPID_EXT ".oldbin"
diff --git a/src/core/ngx_buf.c b/src/core/ngx_buf.c
index b7f597d39..31d990315 100644
--- a/src/core/ngx_buf.c
+++ b/src/core/ngx_buf.c
@@ -151,6 +151,34 @@ ngx_chain_add_copy(ngx_pool_t *pool, ngx_chain_t **chain, ngx_chain_t *in)
}
+ngx_chain_t *
+ngx_chain_get_free_buf(ngx_pool_t *p, ngx_chain_t **free)
+{
+ ngx_chain_t *cl;
+
+ if (*free) {
+ cl = *free;
+ *free = cl->next;
+ cl->next = NULL;
+ return cl;
+ }
+
+ cl = ngx_alloc_chain_link(p);
+ if (cl == NULL) {
+ return NULL;
+ }
+
+ cl->buf = ngx_calloc_buf(p);
+ if (cl->buf == NULL) {
+ return NULL;
+ }
+
+ cl->next = NULL;
+
+ return cl;
+}
+
+
void
ngx_chain_update_chains(ngx_chain_t **free, ngx_chain_t **busy,
ngx_chain_t **out, ngx_buf_tag_t tag)
diff --git a/src/core/ngx_buf.h b/src/core/ngx_buf.h
index 471ab190c..625db2a93 100644
--- a/src/core/ngx_buf.h
+++ b/src/core/ngx_buf.h
@@ -132,6 +132,7 @@ ngx_int_t ngx_chain_writer(void *ctx, ngx_chain_t *in);
ngx_int_t ngx_chain_add_copy(ngx_pool_t *pool, ngx_chain_t **chain,
ngx_chain_t *in);
+ngx_chain_t *ngx_chain_get_free_buf(ngx_pool_t *p, ngx_chain_t **free);
void ngx_chain_update_chains(ngx_chain_t **free, ngx_chain_t **busy,
ngx_chain_t **out, ngx_buf_tag_t tag);
diff --git a/src/core/ngx_conf_file.c b/src/core/ngx_conf_file.c
index acec1308f..d89fa7f32 100644
--- a/src/core/ngx_conf_file.c
+++ b/src/core/ngx_conf_file.c
@@ -77,8 +77,8 @@ ngx_conf_parse(ngx_conf_t *cf, ngx_str_t *filename)
fd = ngx_open_file(filename->data, NGX_FILE_RDONLY, NGX_FILE_OPEN);
if (fd == NGX_INVALID_FILE) {
- ngx_log_error(NGX_LOG_EMERG, cf->log, ngx_errno,
- ngx_open_file_n " \"%s\" failed", filename->data);
+ ngx_conf_log_error(NGX_LOG_EMERG, cf, ngx_errno,
+ ngx_open_file_n " \"%s\" failed", filename->data);
return NGX_CONF_ERROR;
}
@@ -451,12 +451,18 @@ ngx_conf_read_token(ngx_conf_t *cf)
return NGX_CONF_BLOCK_START;
}
- ngx_log_error(NGX_LOG_EMERG, cf->log, 0,
- "unexpected \"%c\" in %s:%ui",
- ch, cf->conf_file->file.name.data,
- cf->conf_file->line);
+ if (ch == ')') {
+ last_space = 1;
+ need_space = 0;
- return NGX_ERROR;
+ } else {
+ ngx_log_error(NGX_LOG_EMERG, cf->log, 0,
+ "unexpected \"%c\" in %s:%ui",
+ ch, cf->conf_file->file.name.data,
+ cf->conf_file->line);
+
+ return NGX_ERROR;
+ }
}
if (last_space) {
@@ -1167,6 +1173,20 @@ ngx_conf_unsupported(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
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;
+}
+
+
+char *
ngx_conf_check_num_bounds(ngx_conf_t *cf, void *post, void *data)
{
ngx_conf_num_bounds_t *bounds = post;
diff --git a/src/core/ngx_conf_file.h b/src/core/ngx_conf_file.h
index 2ef595d59..e1859f852 100644
--- a/src/core/ngx_conf_file.h
+++ b/src/core/ngx_conf_file.h
@@ -189,6 +189,13 @@ typedef struct {
typedef struct {
ngx_conf_post_handler_pt post_handler;
+ char *old_name;
+ char *new_name;
+} ngx_conf_deprecated_t;
+
+
+typedef struct {
+ ngx_conf_post_handler_pt post_handler;
ngx_int_t low;
ngx_int_t high;
} ngx_conf_num_bounds_t;
@@ -208,6 +215,8 @@ typedef struct {
} ngx_conf_bitmask_t;
+
+char * ngx_conf_deprecated(ngx_conf_t *cf, void *post, void *data);
char *ngx_conf_check_num_bounds(ngx_conf_t *cf, void *post, void *data);
diff --git a/src/core/ngx_config.h b/src/core/ngx_config.h
index 3b51e9622..96569b893 100644
--- a/src/core/ngx_config.h
+++ b/src/core/ngx_config.h
@@ -76,32 +76,30 @@
#if 1
/* STUB: autoconf */
-typedef int ngx_int_t;
-typedef u_int ngx_uint_t;
-typedef int ngx_flag_t;
-#define NGX_INT_T_LEN sizeof("-2147483648") - 1
+typedef int ngx_int_t;
+typedef u_int ngx_uint_t;
+typedef int ngx_flag_t;
+#define NGX_INT_T_LEN sizeof("-2147483648") - 1
#else
-typedef long ngx_int_t;
-typedef u_long ngx_uint_t;
-typedef long ngx_flag_t;
-#define NGX_INT_T_LEN sizeof("-9223372036854775808") - 1
+typedef long ngx_int_t;
+typedef u_long ngx_uint_t;
+typedef long ngx_flag_t;
+#define NGX_INT_T_LEN sizeof("-9223372036854775808") - 1
#endif
-#define NGX_INT32_LEN sizeof("-2147483648") - 1
-#define NGX_INT64_LEN sizeof("-9223372036854775808") - 1
+#define NGX_INT32_LEN sizeof("-2147483648") - 1
+#define NGX_INT64_LEN sizeof("-9223372036854775808") - 1
-#if (NGX_SOLARIS)
-#define NGX_ALIGN (_MAX_ALIGNMENT - 1)
-#else
-/* TODO: auto_conf */
-#define NGX_ALIGN (sizeof(unsigned long) - 1) /* platform word */
+#ifndef NGX_ALIGNMENT
+#define NGX_ALIGNMENT sizeof(unsigned long) /* platform word */
#endif
-#define ngx_align(p) (u_char *) (((uintptr_t) p + NGX_ALIGN) & ~NGX_ALIGN)
+#define ngx_align(p) (u_char *) (((uintptr_t) p + (NGX_ALIGNMENT - 1)) \
+ & ~(NGX_ALIGNMENT - 1))
#define ngx_abort abort
@@ -109,7 +107,7 @@ typedef long ngx_flag_t;
/* TODO: auto_conf: ngx_inline inline __inline __inline__ */
#ifndef ngx_inline
-#define ngx_inline inline
+#define ngx_inline inline
#endif
#define NGX_ACCEPT_THRESHOLD 100
diff --git a/src/core/ngx_inet.c b/src/core/ngx_inet.c
index d44e300ca..ee68fc1c2 100644
--- a/src/core/ngx_inet.c
+++ b/src/core/ngx_inet.c
@@ -12,8 +12,8 @@
/*
* ngx_sock_ntop() and ngx_inet_ntop() may be implemented as
- * "ngx_sprintf(text, "%ud.%ud.%ud.%ud", p[0], p[1], p[2], p[3])",
- * however, they were implemented long before the ngx_sprintf() appeared
+ * "ngx_sprintf(text, "%ud.%ud.%ud.%ud", p[0], p[1], p[2], p[3])", however,
+ * they had been implemented long before the ngx_sprintf() had appeared
* and they are faster by 1.5-2.5 times, so it is worth to keep them.
*
* By the way, the implementation using ngx_sprintf() is faster by 2.5-3 times
diff --git a/src/core/ngx_palloc.c b/src/core/ngx_palloc.c
index d1e7bbdc5..a1f9d59cd 100644
--- a/src/core/ngx_palloc.c
+++ b/src/core/ngx_palloc.c
@@ -20,9 +20,10 @@ ngx_create_pool(size_t size, ngx_log_t *log)
p->last = (u_char *) p + sizeof(ngx_pool_t);
p->end = (u_char *) p + size;
+ p->current = p;
+ p->chain = NULL;
p->next = NULL;
p->large = NULL;
- p->chain = NULL;
p->cleanup = NULL;
p->log = log;
@@ -91,7 +92,7 @@ ngx_palloc(ngx_pool_t *pool, size_t size)
&& size <= (size_t) (pool->end - (u_char *) pool)
- (size_t) ngx_align(sizeof(ngx_pool_t)))
{
- for (p = pool, n = pool->next; /* void */; p = n, n = n->next) {
+ for (p = pool->current; /* void */ ; p = p->next) {
m = ngx_align(p->last);
if ((size_t) (p->end - m) >= size) {
@@ -100,7 +101,11 @@ ngx_palloc(ngx_pool_t *pool, size_t size)
return m;
}
- if (n == NULL) {
+ if ((size_t) (p->end - m) < NGX_ALIGNMENT) {
+ p->current = p->next;
+ }
+
+ if (p->next == NULL) {
break;
}
}
@@ -112,6 +117,10 @@ ngx_palloc(ngx_pool_t *pool, size_t size)
return NULL;
}
+ if (p->current == NULL) {
+ p->current = n;
+ }
+
p->next = n;
m = ngx_align(n->last);
n->last = m + size;
diff --git a/src/core/ngx_palloc.h b/src/core/ngx_palloc.h
index b8b169244..30590ee9e 100644
--- a/src/core/ngx_palloc.h
+++ b/src/core/ngx_palloc.h
@@ -44,6 +44,7 @@ struct ngx_pool_large_s {
struct ngx_pool_s {
u_char *last;
u_char *end;
+ ngx_pool_t *current;
ngx_chain_t *chain;
ngx_pool_t *next;
ngx_pool_large_t *large;