nginx-0.1.18-RELEASE import
*) Workaround: the default values of the devpoll_events and the
devpoll_changes directives changed from 512 to 32 to be compatible
with Solaris 10.
*) Bugfix: the proxy_set_x_var and fastcgi_set_var directives were not
inherited.
*) Bugfix: in the redirect rewrite directive the arguments were
concatenated with URI by the "&" rather than the "?".
*) Bugfix: the lines without trailing ";" in the file being included by
the ngx_http_geo_module were silently ignored.
*) Feature: the ngx_http_stub_status_module.
*) Bugfix: the unknown log format in the access_log directive caused
the segmentation fault.
*) Feature: the new "document_root" parameter of the fastcgi_params
directive.
*) Feature: the fastcgi_redirect_errors directive.
*) Feature: the new "break" modifier of the "rewrite" directive allows
to stop the rewrite/location cycle and sets the current
configuration to the request.
diff --git a/src/core/nginx.h b/src/core/nginx.h
index c6afc45..dbadb45 100644
--- a/src/core/nginx.h
+++ b/src/core/nginx.h
@@ -8,7 +8,7 @@
#define _NGINX_H_INCLUDED_
-#define NGINX_VER "nginx/0.1.17"
+#define NGINX_VER "nginx/0.1.18"
#define NGINX_VAR "NGINX"
#define NGX_NEWPID_EXT ".newbin"
diff --git a/src/core/ngx_conf_file.c b/src/core/ngx_conf_file.c
index e9cc24d..436103a 100644
--- a/src/core/ngx_conf_file.c
+++ b/src/core/ngx_conf_file.c
@@ -48,7 +48,7 @@
NGX_CONF_TAKE7
};
-static int ngx_conf_read_token(ngx_conf_t *cf);
+static ngx_int_t ngx_conf_read_token(ngx_conf_t *cf);
char *ngx_conf_parse(ngx_conf_t *cf, ngx_str_t *filename)
@@ -337,7 +337,7 @@
}
-static int ngx_conf_read_token(ngx_conf_t *cf)
+static ngx_int_t ngx_conf_read_token(ngx_conf_t *cf)
{
u_char *start, ch, *src, *dst;
int len;
@@ -361,7 +361,17 @@
if (b->pos >= b->last) {
if (cf->conf_file->file.offset
- >= ngx_file_size(&cf->conf_file->file.info)) {
+ >= ngx_file_size(&cf->conf_file->file.info))
+ {
+ if (cf->args->nelts > 0) {
+ ngx_log_error(NGX_LOG_EMERG, cf->log, 0,
+ "unexpected end of file in %s:%d, "
+ "expecting \";\" or \"}\"",
+ cf->conf_file->file.name.data,
+ cf->conf_file->line);
+ return NGX_ERROR;
+ }
+
return NGX_CONF_FILE_DONE;
}
@@ -418,7 +428,7 @@
}
ngx_log_error(NGX_LOG_EMERG, cf->log, 0,
- "unexpected '%c' in %s:%d",
+ "unexpected \"%c\" in %s:%d",
ch, cf->conf_file->file.name.data,
cf->conf_file->line);
@@ -438,7 +448,7 @@
case '{':
if (cf->args->nelts == 0) {
ngx_log_error(NGX_LOG_EMERG, cf->log, 0,
- "unexpected '%c' in %s:%d",
+ "unexpected \"%c\" in %s:%d",
ch, cf->conf_file->file.name.data,
cf->conf_file->line);
return NGX_ERROR;
@@ -453,7 +463,7 @@
case '}':
if (cf->args->nelts > 0) {
ngx_log_error(NGX_LOG_EMERG, cf->log, 0,
- "unexpected '}' in %s:%d",
+ "unexpected \"}\" in %s:%d",
cf->conf_file->file.name.data,
cf->conf_file->line);
return NGX_ERROR;
diff --git a/src/core/ngx_connection.c b/src/core/ngx_connection.c
index b3fa5de..e8f06fd 100644
--- a/src/core/ngx_connection.c
+++ b/src/core/ngx_connection.c
@@ -397,7 +397,6 @@
}
-
ngx_int_t ngx_connection_error(ngx_connection_t *c, ngx_err_t err, char *text)
{
ngx_uint_t level;
diff --git a/src/core/ngx_inet.c b/src/core/ngx_inet.c
index 56d2e98..a30ff03 100644
--- a/src/core/ngx_inet.c
+++ b/src/core/ngx_inet.c
@@ -313,7 +313,7 @@
sin->sin_family = AF_INET;
sin->sin_port = u->port;
- sin->sin_addr.s_addr = *(in_addr_t *)(h->h_addr_list[i]);
+ sin->sin_addr.s_addr = *(in_addr_t *) (h->h_addr_list[i]);
peers->peer[i].sockaddr = (struct sockaddr *) sin;
peers->peer[i].socklen = sizeof(struct sockaddr_in);
diff --git a/src/core/ngx_radix_tree.c b/src/core/ngx_radix_tree.c
index 9493bab..e0ce095 100644
--- a/src/core/ngx_radix_tree.c
+++ b/src/core/ngx_radix_tree.c
@@ -11,8 +11,10 @@
static void *ngx_radix_alloc(ngx_radix_tree_t *tree);
-ngx_radix_tree_t *ngx_radix_tree_create(ngx_pool_t *pool)
+ngx_radix_tree_t *
+ngx_radix_tree_create(ngx_pool_t *pool, ngx_uint_t preallocate)
{
+ uint32_t key, mask, inc;
ngx_radix_tree_t *tree;
if (!(tree = ngx_palloc(pool, sizeof(ngx_radix_tree_t)))) {
@@ -33,12 +35,43 @@
tree->root->parent = NULL;
tree->root->value = NGX_RADIX_NO_VALUE;
+ /*
+ * We preallocate the first nodes: 0, 1, 00, 01, 10, 11, 000, 001, etc.,
+ * to increase the TLB hits even if for the first lookup iterations.
+ * On the 32-bit platforms the 7 preallocated bits takes continuous 4K,
+ * 8 - 8K, 9 - 16K, etc.
+ */
+
+ mask = 0;
+ inc = 0x80000000;
+
+ while (preallocate--) {
+
+ key = 0;
+ mask >>= 1;
+ mask |= 0x80000000;
+
+ do {
+ if (ngx_radix32tree_insert(tree, key, mask, NGX_RADIX_NO_VALUE)
+ != NGX_OK)
+ {
+ return NULL;
+ }
+
+ key += inc;
+
+ } while (key);
+
+ inc >>= 1;
+ }
+
return tree;
}
-ngx_int_t ngx_radix32tree_insert(ngx_radix_tree_t *tree,
- uint32_t key, uint32_t mask, uintptr_t value)
+ngx_int_t
+ngx_radix32tree_insert(ngx_radix_tree_t *tree, uint32_t key, uint32_t mask,
+ uintptr_t value)
{
uint32_t bit;
ngx_radix_node_t *node, *next;
@@ -100,8 +133,8 @@
}
-ngx_int_t ngx_radix32tree_delete(ngx_radix_tree_t *tree,
- uint32_t key, uint32_t mask)
+ngx_int_t
+ngx_radix32tree_delete(ngx_radix_tree_t *tree, uint32_t key, uint32_t mask)
{
uint32_t bit;
ngx_radix_node_t *node;
@@ -158,7 +191,8 @@
}
-uintptr_t ngx_radix32tree_find(ngx_radix_tree_t *tree, uint32_t key)
+uintptr_t
+ngx_radix32tree_find(ngx_radix_tree_t *tree, uint32_t key)
{
uint32_t bit;
uintptr_t value;
@@ -187,7 +221,8 @@
}
-static void *ngx_radix_alloc(ngx_radix_tree_t *tree)
+static void *
+ngx_radix_alloc(ngx_radix_tree_t *tree)
{
char *p;
diff --git a/src/core/ngx_radix_tree.h b/src/core/ngx_radix_tree.h
index c2d8a36..99c6eea 100644
--- a/src/core/ngx_radix_tree.h
+++ b/src/core/ngx_radix_tree.h
@@ -33,11 +33,12 @@
} ngx_radix_tree_t;
-ngx_radix_tree_t *ngx_radix_tree_create(ngx_pool_t *pool);
+ngx_radix_tree_t *ngx_radix_tree_create(ngx_pool_t *pool,
+ ngx_uint_t preallocate);
ngx_int_t ngx_radix32tree_insert(ngx_radix_tree_t *tree,
- uint32_t key, uint32_t mask, uintptr_t value);
+ uint32_t key, uint32_t mask, uintptr_t value);
ngx_int_t ngx_radix32tree_delete(ngx_radix_tree_t *tree,
- uint32_t key, uint32_t mask);
+ uint32_t key, uint32_t mask);
uintptr_t ngx_radix32tree_find(ngx_radix_tree_t *tree, uint32_t key);