summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2007-05-28 14:56:45 +0000
committerJonathan Kolb <jon@b0g.us>2007-05-28 14:56:45 +0000
commit7b2348282df005c03f11798b5d64cf9c13c35518 (patch)
treec929c61be3d02e967e4d196a37acdfc52f2f6ef9
parentd7127be32835b36710aee355677f37777046bd13 (diff)
downloadnginx-7b2348282df005c03f11798b5d64cf9c13c35518.tar.gz
Changes with nginx 0.5.21 28 May 2007v0.5.21
*) Bugfix: if server has more than about ten locations, then regex locations may be choosen not in that order as they were specified. *) Bugfix: a worker process may got caught in an endless loop on 64-bit platform, if the 33-rd or next in succession backend has failed. Thanks to Anton Povarov. *) Bugfix: a bus error might occur on Solaris/sparc64 if the PCRE library was used. Thanks to Andrei Nigmatulin. *) Bugfix: in the HTTPS protocol in the "proxy_pass" directive.
-rw-r--r--CHANGES16
-rw-r--r--CHANGES.ru17
-rw-r--r--src/core/nginx.h2
-rw-r--r--src/core/ngx_output_chain.c5
-rw-r--r--src/core/ngx_palloc.c13
-rw-r--r--src/core/ngx_string.c27
-rw-r--r--src/core/ngx_string.h18
-rw-r--r--src/event/ngx_event_openssl.c1
-rw-r--r--src/http/modules/perl/nginx.pm2
-rw-r--r--src/http/ngx_http.c9
-rw-r--r--src/http/ngx_http_core_module.c17
-rw-r--r--src/http/ngx_http_upstream_round_robin.c4
-rw-r--r--src/mail/ngx_mail.c9
13 files changed, 106 insertions, 34 deletions
diff --git a/CHANGES b/CHANGES
index 750ceb1c5..013a05f0e 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,4 +1,20 @@
+Changes with nginx 0.5.21 28 May 2007
+
+ *) Bugfix: if server has more than about ten locations, then regex
+ locations may be choosen not in that order as they were specified.
+
+ *) Bugfix: a worker process may got caught in an endless loop on 64-bit
+ platform, if the 33-rd or next in succession backend has failed.
+ Thanks to Anton Povarov.
+
+ *) Bugfix: a bus error might occur on Solaris/sparc64 if the PCRE
+ library was used.
+ Thanks to Andrei Nigmatulin.
+
+ *) Bugfix: in the HTTPS protocol in the "proxy_pass" directive.
+
+
Changes with nginx 0.5.20 07 May 2007
*) Feature: the "sendfile_max_chunk" directive.
diff --git a/CHANGES.ru b/CHANGES.ru
index 591689ea1..bd09a89e1 100644
--- a/CHANGES.ru
+++ b/CHANGES.ru
@@ -1,4 +1,21 @@
+Изменения в nginx 0.5.21 28.05.2007
+
+ *) Исправление: если внутри сервера описано больше примерно десяти
+ location'ов, то location'ы, заданные с помощью регулярного
+ выражения, могут выполняться не в том, порядке, в каком они описаны.
+
+ *) Исправление: на 64-битной платформе рабочий процесс мог зациклиться,
+ если 33-тий по счёту или последующий бэкенд упал.
+ Спасибо Антону Поварову.
+
+ *) Исправление: при использовании библиотеки PCRE на Solaris/sparc64
+ мог произойти bus error.
+ Спасибо Андрею Нигматулину.
+
+ *) Исправление: в использовании протокола HTTPS в директиве proxy_pass.
+
+
Изменения в nginx 0.5.20 07.05.2007
*) Добавление: директива sendfile_max_chunk.
diff --git a/src/core/nginx.h b/src/core/nginx.h
index 4466b3c62..a79b577d5 100644
--- a/src/core/nginx.h
+++ b/src/core/nginx.h
@@ -8,7 +8,7 @@
#define _NGINX_H_INCLUDED_
-#define NGINX_VERSION "0.5.20"
+#define NGINX_VERSION "0.5.21"
#define NGINX_VER "nginx/" NGINX_VERSION
#define NGINX_VAR "NGINX"
diff --git a/src/core/ngx_output_chain.c b/src/core/ngx_output_chain.c
index 4479edacc..e2dcc4c52 100644
--- a/src/core/ngx_output_chain.c
+++ b/src/core/ngx_output_chain.c
@@ -473,7 +473,7 @@ ngx_chain_writer(void *data, ngx_chain_t *in)
size += ngx_buf_size(cl->buf);
}
- if (size == 0) {
+ if (size == 0 && !ctx->connection->buffered) {
return NGX_OK;
}
@@ -489,6 +489,9 @@ ngx_chain_writer(void *data, ngx_chain_t *in)
if (ctx->out == NULL) {
ctx->last = &ctx->out;
+ }
+
+ if (!ctx->connection->buffered) {
return NGX_OK;
}
diff --git a/src/core/ngx_palloc.c b/src/core/ngx_palloc.c
index 4288bf10a..2e72a0f3b 100644
--- a/src/core/ngx_palloc.c
+++ b/src/core/ngx_palloc.c
@@ -97,10 +97,21 @@ ngx_palloc(ngx_pool_t *pool, size_t size)
for ( ;; ) {
+#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)
+ */
+
if (size < sizeof(int) || (size & 1)) {
m = p->last;
- } else {
+ } else
+#endif
+
+ {
m = ngx_align_ptr(p->last, NGX_ALIGNMENT);
}
diff --git a/src/core/ngx_string.c b/src/core/ngx_string.c
index fe8cfacdd..7b5287f0a 100644
--- a/src/core/ngx_string.c
+++ b/src/core/ngx_string.c
@@ -1202,6 +1202,33 @@ done:
}
+/* ngx_sort() is implemented as insertion sort because we need stable sort */
+
+void
+ngx_sort(void *base, size_t n, size_t size,
+ int (*cmp)(const void *, const void *))
+{
+ u_char *p1, *p2;
+ u_char buf[256];
+
+ for (p1 = (u_char *) base + size;
+ p1 < (u_char *) base + n * size;
+ p1 += size)
+ {
+ ngx_memcpy(buf, p1, size);
+
+ for (p2 = p1;
+ p2 > (u_char *) base && cmp(p2 - size, buf) > 0;
+ p2 -= size)
+ {
+ ngx_memcpy(p2, p2 - size, size);
+ }
+
+ ngx_memcpy(p2, buf, size);
+ }
+}
+
+
#if (NGX_MEMCPY_LIMIT)
void *
diff --git a/src/core/ngx_string.h b/src/core/ngx_string.h
index db7857a36..18306d2d2 100644
--- a/src/core/ngx_string.h
+++ b/src/core/ngx_string.h
@@ -136,25 +136,27 @@ ngx_int_t ngx_decode_base64(ngx_str_t *dst, ngx_str_t *src);
uint32_t ngx_utf_decode(u_char **p, size_t n);
size_t ngx_utf_length(u_char *p, size_t n);
-u_char * ngx_utf_cpystrn(u_char *dst, u_char *src, size_t n);
+u_char *ngx_utf_cpystrn(u_char *dst, u_char *src, size_t n);
-#define NGX_ESCAPE_URI 0
-#define NGX_ESCAPE_ARGS 1
-#define NGX_ESCAPE_HTML 2
+#define NGX_ESCAPE_URI 0
+#define NGX_ESCAPE_ARGS 1
+#define NGX_ESCAPE_HTML 2
-#define NGX_UNESCAPE_URI 1
+#define NGX_UNESCAPE_URI 1
uintptr_t ngx_escape_uri(u_char *dst, u_char *src, size_t size,
ngx_uint_t type);
void ngx_unescape_uri(u_char **dst, u_char **src, size_t size, ngx_uint_t type);
-#define ngx_qsort qsort
+void ngx_sort(void *base, size_t n, size_t size,
+ int (*cmp)(const void *, const void *));
+#define ngx_qsort qsort
-#define ngx_value_helper(n) #n
-#define ngx_value(n) ngx_value_helper(n)
+#define ngx_value_helper(n) #n
+#define ngx_value(n) ngx_value_helper(n)
#endif /* _NGX_STRING_H_INCLUDED_ */
diff --git a/src/event/ngx_event_openssl.c b/src/event/ngx_event_openssl.c
index 5bd3b6a16..d31196887 100644
--- a/src/event/ngx_event_openssl.c
+++ b/src/event/ngx_event_openssl.c
@@ -748,7 +748,6 @@ ngx_ssl_send_chain(ngx_connection_t *c, ngx_chain_t *in, off_t limit)
if (!c->ssl->buffer
|| (in && in->next == NULL && !(c->buffered & NGX_SSL_BUFFERED)))
{
-
/*
* we avoid a buffer copy if
* we do not need to buffer the output
diff --git a/src/http/modules/perl/nginx.pm b/src/http/modules/perl/nginx.pm
index d6f47c078..dd75ec8e3 100644
--- a/src/http/modules/perl/nginx.pm
+++ b/src/http/modules/perl/nginx.pm
@@ -47,7 +47,7 @@ our @EXPORT = qw(
HTTP_INSUFFICIENT_STORAGE
);
-our $VERSION = '0.5.20';
+our $VERSION = '0.5.21';
require XSLoader;
XSLoader::load('nginx', $VERSION);
diff --git a/src/http/ngx_http.c b/src/http/ngx_http.c
index 7a1eb89b3..46e576a90 100644
--- a/src/http/ngx_http.c
+++ b/src/http/ngx_http.c
@@ -19,8 +19,7 @@ static ngx_int_t ngx_http_add_names(ngx_conf_t *cf,
static char *ngx_http_merge_locations(ngx_conf_t *cf,
ngx_array_t *locations, void **loc_conf, ngx_http_module_t *module,
ngx_uint_t ctx_index);
-static int ngx_libc_cdecl ngx_http_cmp_conf_in_addrs(const void *one,
- const void *two);
+static int ngx_http_cmp_conf_in_addrs(const void *one, const void *two);
static int ngx_libc_cdecl ngx_http_cmp_dns_wildcards(const void *one,
const void *two);
@@ -599,8 +598,8 @@ ngx_http_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
in_port = in_ports.elts;
for (p = 0; p < in_ports.nelts; p++) {
- ngx_qsort(in_port[p].addrs.elts, (size_t) in_port[p].addrs.nelts,
- sizeof(ngx_http_conf_in_addr_t), ngx_http_cmp_conf_in_addrs);
+ ngx_sort(in_port[p].addrs.elts, (size_t) in_port[p].addrs.nelts,
+ sizeof(ngx_http_conf_in_addr_t), ngx_http_cmp_conf_in_addrs);
/*
* check whether all name-based servers have the same configuraiton
@@ -1027,7 +1026,7 @@ ngx_http_merge_locations(ngx_conf_t *cf, ngx_array_t *locations,
}
-static int ngx_libc_cdecl
+static int
ngx_http_cmp_conf_in_addrs(const void *one, const void *two)
{
ngx_http_conf_in_addr_t *first, *second;
diff --git a/src/http/ngx_http_core_module.c b/src/http/ngx_http_core_module.c
index dd7ffc0f3..2334f6daa 100644
--- a/src/http/ngx_http_core_module.c
+++ b/src/http/ngx_http_core_module.c
@@ -45,8 +45,7 @@ static char *ngx_http_core_server(ngx_conf_t *cf, ngx_command_t *cmd,
void *dummy);
static char *ngx_http_core_location(ngx_conf_t *cf, ngx_command_t *cmd,
void *dummy);
-static int ngx_libc_cdecl ngx_http_core_cmp_locations(const void *first,
- const void *second);
+static int ngx_http_core_cmp_locations(const void *first, const void *second);
static char *ngx_http_core_types(ngx_conf_t *cf, ngx_command_t *cmd,
void *conf);
@@ -1642,8 +1641,8 @@ ngx_http_core_server(ngx_conf_t *cf, ngx_command_t *cmd, void *dummy)
return rv;
}
- ngx_qsort(cscf->locations.elts, (size_t) cscf->locations.nelts,
- sizeof(ngx_http_core_loc_conf_t *), ngx_http_core_cmp_locations);
+ ngx_sort(cscf->locations.elts, (size_t) cscf->locations.nelts,
+ sizeof(ngx_http_core_loc_conf_t *), ngx_http_core_cmp_locations);
return rv;
}
@@ -1774,10 +1773,10 @@ ngx_http_core_location(ngx_conf_t *cf, ngx_command_t *cmd, void *dummy)
#if (NGX_PCRE)
if (clcf->regex == NULL
&& ngx_strncmp(clcf->name.data, pclcf->name.data, pclcf->name.len)
- != 0)
+ != 0)
#else
if (ngx_strncmp(clcf->name.data, pclcf->name.data, pclcf->name.len)
- != 0)
+ != 0)
#endif
{
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
@@ -1814,14 +1813,14 @@ ngx_http_core_location(ngx_conf_t *cf, ngx_command_t *cmd, void *dummy)
return rv;
}
- ngx_qsort(clcf->locations.elts, (size_t) clcf->locations.nelts,
- sizeof(ngx_http_core_loc_conf_t *), ngx_http_core_cmp_locations);
+ ngx_sort(clcf->locations.elts, (size_t) clcf->locations.nelts,
+ sizeof(ngx_http_core_loc_conf_t *), ngx_http_core_cmp_locations);
return rv;
}
-static int ngx_libc_cdecl
+static int
ngx_http_core_cmp_locations(const void *one, const void *two)
{
ngx_int_t rc;
diff --git a/src/http/ngx_http_upstream_round_robin.c b/src/http/ngx_http_upstream_round_robin.c
index 359a73624..b54e7a72d 100644
--- a/src/http/ngx_http_upstream_round_robin.c
+++ b/src/http/ngx_http_upstream_round_robin.c
@@ -215,7 +215,7 @@ ngx_http_upstream_get_round_robin_peer(ngx_peer_connection_t *pc, void *data)
rrp->current = rrp->peers->current;
n = rrp->current / (8 * sizeof(uintptr_t));
- m = 1 << rrp->current % (8 * sizeof(uintptr_t));
+ m = (uintptr_t) 1 << rrp->current % (8 * sizeof(uintptr_t));
if (!(rrp->tried[n] & m)) {
peer = &rrp->peers->peer[rrp->current];
@@ -268,7 +268,7 @@ ngx_http_upstream_get_round_robin_peer(ngx_peer_connection_t *pc, void *data)
} else {
for ( ;; ) {
n = rrp->current / (8 * sizeof(uintptr_t));
- m = 1 << rrp->current % (8 * sizeof(uintptr_t));
+ m = (uintptr_t) 1 << rrp->current % (8 * sizeof(uintptr_t));
if (!(rrp->tried[n] & m)) {
diff --git a/src/mail/ngx_mail.c b/src/mail/ngx_mail.c
index 56e9b04c1..ec74e6f03 100644
--- a/src/mail/ngx_mail.c
+++ b/src/mail/ngx_mail.c
@@ -11,8 +11,7 @@
static char *ngx_mail_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf);
-static int ngx_libc_cdecl ngx_mail_cmp_conf_in_addrs(const void *one,
- const void *two);
+static int ngx_mail_cmp_conf_in_addrs(const void *one, const void *two);
ngx_uint_t ngx_mail_max_module;
@@ -269,8 +268,8 @@ ngx_mail_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
in_port = in_ports.elts;
for (p = 0; p < in_ports.nelts; p++) {
- ngx_qsort(in_port[p].addrs.elts, (size_t) in_port[p].addrs.nelts,
- sizeof(ngx_mail_conf_in_addr_t), ngx_mail_cmp_conf_in_addrs);
+ ngx_sort(in_port[p].addrs.elts, (size_t) in_port[p].addrs.nelts,
+ sizeof(ngx_mail_conf_in_addr_t), ngx_mail_cmp_conf_in_addrs);
in_addr = in_port[p].addrs.elts;
last = in_port[p].addrs.nelts;
@@ -387,7 +386,7 @@ ngx_mail_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
}
-static int ngx_libc_cdecl
+static int
ngx_mail_cmp_conf_in_addrs(const void *one, const void *two)
{
ngx_mail_conf_in_addr_t *first, *second;