summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2006-03-10 12:51:52 +0000
committerIgor Sysoev <igor@sysoev.ru>2006-03-10 12:51:52 +0000
commit13c68741f29943d0ba45f7c9d5a5c4251d5f16f6 (patch)
tree539580ab05f906419ca310ab8e0d437a1ae7fec8
parent15465ff78e5b53c9fb88dfde0adb8c99f6066892 (diff)
downloadnginx-release-0.3.31.tar.gz
nginx-0.3.31-RELEASE importrelease-0.3.31
*) Change: now nginx passes the malformed proxied backend responses. *) Feature: the "listen" directives support the address in the "*:port" form. *) Feature: the EVFILER_TIMER support in MacOSX 10.4. *) Workaround: for MacOSX 64-bit kernel kqueue millisecond timeout bug. Thanks to Andrei Nigmatulin. *) Bugfix: if there were several "listen" directives listening one various addresses inside one server, then server names like "*.domain.tld" worked for first address only; the bug had appeared in 0.3.18. *) Bugfix: if the HTTPS protocol was used in the "proxy_pass" directive and the request body was in temporarily file then the request was not transferred. *) Bugfix: perl 5.8.8 compatibility.
-rw-r--r--auto/feature63
-rw-r--r--auto/os/features81
-rw-r--r--docs/xml/nginx/changes.xml86
-rw-r--r--src/core/nginx.h2
-rw-r--r--src/core/ngx_hash.c40
-rw-r--r--src/event/modules/ngx_kqueue_module.c11
-rw-r--r--src/http/modules/ngx_http_fastcgi_module.c3
-rw-r--r--src/http/modules/ngx_http_proxy_module.c9
-rw-r--r--src/http/modules/perl/Makefile.PL1
-rw-r--r--src/http/modules/perl/ngx_http_perl_module.c2
-rw-r--r--src/http/ngx_http.c8
-rw-r--r--src/http/ngx_http_core_module.c4
-rw-r--r--src/http/ngx_http_request.h1
-rw-r--r--src/http/ngx_http_upstream.c7
-rw-r--r--src/http/ngx_http_upstream.h2
-rw-r--r--src/imap/ngx_imap_core_module.c4
16 files changed, 261 insertions, 63 deletions
diff --git a/auto/feature b/auto/feature
index 5a40c6983..15da5bde3 100644
--- a/auto/feature
+++ b/auto/feature
@@ -39,29 +39,46 @@ eval "$ngx_test >> $NGX_AUTOCONF_ERR 2>&1"
if [ -x $NGX_AUTOTEST ]; then
- if [ $ngx_feature_run = yes ]; then
-
- if $NGX_AUTOTEST 2>&1 > /dev/null; then
- echo " found"
- ngx_found=yes
-
- if test -n "$ngx_feature_name"; then
- have=$ngx_have_feature . auto/have
- fi
-
- else
- echo " found but is not working"
- fi
-
- else
- echo " found"
- ngx_found=yes
-
- if test -n "$ngx_feature_name"; then
- have=$ngx_have_feature . auto/have
- fi
-
- fi
+ case "$ngx_feature_run" in
+
+ yes)
+ if $NGX_AUTOTEST 2>&1 > /dev/null; then
+ echo " found"
+ ngx_found=yes
+
+ if test -n "$ngx_feature_name"; then
+ have=$ngx_have_feature . auto/have
+ fi
+
+ else
+ echo " found but is not working"
+ fi
+ ;;
+
+ bug)
+ if $NGX_AUTOTEST 2>&1 > /dev/null; then
+ echo " not found"
+
+ else
+ echo " found"
+ ngx_found=yes
+
+ if test -n "$ngx_feature_name"; then
+ have=$ngx_have_feature . auto/have
+ fi
+ fi
+ ;;
+
+ *)
+ echo " found"
+ ngx_found=yes
+
+ if test -n "$ngx_feature_name"; then
+ have=$ngx_have_feature . auto/have
+ fi
+ ;;
+
+ esac
else
echo " not found"
diff --git a/auto/os/features b/auto/os/features
index 848e48309..702815187 100644
--- a/auto/os/features
+++ b/auto/os/features
@@ -87,13 +87,88 @@ if test -z "$NGX_KQUEUE_CHECKED"; then
ngx_feature_test="struct kevent kev;
kev.fflags = NOTE_LOWAT;"
. auto/feature
+
+
+ ngx_feature="kqueue's EVFILT_TIMER"
+ ngx_feature_name="NGX_HAVE_TIMER_EVENT"
+ ngx_feature_run=yes
+ ngx_feature_incs="#include <sys/event.h>
+#include <sys/time.h>"
+ ngx_feature_libs=
+ ngx_feature_test="int kq;
+ struct kevent kev;
+ struct timespec ts;
+
+ if ((kq = kqueue()) == -1) return 1;
+
+ kev.ident = 0;
+ kev.filter = EVFILT_TIMER;
+ kev.flags = EV_ADD|EV_ENABLE;
+ kev.fflags = 0;
+ kev.data = 1000;
+ kev.udata = 0;
+
+ ts.tv_sec = 0;
+ ts.tv_nsec = 0;
+
+ if (kevent(kq, &kev, 1, &kev, 1, &ts) == -1) return 1;
+
+ if (kev.flags & EV_ERROR) return 1;"
+
+ . auto/feature
+
+
+ if [ "$NGX_SYSTEM" = "Darwin" ]; then
+
+ ngx_feature="MacOSX 64-bit kqueue millisecond timeout bug"
+ ngx_feature_name=
+ ngx_feature_run=bug
+ ngx_feature_incs="#include <sys/event.h>
+#include <sys/time.h>"
+ ngx_feature_libs=
+ ngx_feature_test="int kq;
+ struct kevent kev;
+ struct timespec ts;
+ struct timeval tv, tv0;
+
+ kq = kqueue();
+
+ ts.tv_sec = 0;
+ ts.tv_nsec = 999000000;
+
+ gettimeofday(&tv, 0);
+ kevent(kq, NULL, 0, &kev, 1, &ts);
+ gettimeofday(&tv0, 0);
+ timersub(&tv0, &tv, &tv);
+
+ if (tv.tv_sec * 1000000 + tv.tv_usec < 900000) return 1;"
+
+ . auto/feature
+
+ ngx_macosx_kevent_bug=$ngx_found
+ fi
fi
fi
-if [ "$NGX_SYSTEM" = "NetBSD" ]; then
- have=NGX_HAVE_TIMER_EVENT . auto/have
- echo " + kqueue's EVFILT_TIMER found"
+if [ ".$ngx_macosx_kevent_bug" = .yes ]; then
+
+ cat << END >> $NGX_AUTO_CONFIG_H
+
+#define NGX_MACOSX_KEVENT_BUG_SHIFT << 32
+
+END
+
+else
+ cat << END >> $NGX_AUTO_CONFIG_H
+
+#define NGX_MACOSX_KEVENT_BUG_SHIFT
+
+END
+fi
+
+
+if [ "$NGX_SYSTEM" = "NetBSD" ]; then
# NetBSD 2.0 incompatibly defines kevent.udata as "intptr_t"
diff --git a/docs/xml/nginx/changes.xml b/docs/xml/nginx/changes.xml
index 08ca5a041..61c603410 100644
--- a/docs/xml/nginx/changes.xml
+++ b/docs/xml/nginx/changes.xml
@@ -9,6 +9,84 @@
<title lang="en">nginx changelog</title>
+<changes ver="0.3.31" date="10.03.2006">
+
+<change type="change">
+<para lang="ru">
+теперь nginx передаёт неверные ответы проксированного бэкенда.
+</para>
+<para lang="en">
+now nginx passes the malformed proxied backend responses.
+</para>
+</change>
+
+<change type="feature">
+<para lang="ru">
+директивы listen поддерживают адрес в виде "*:порт".
+</para>
+<para lang="en">
+the "listen" directives support the address in the "*:port" form.
+</para>
+</change>
+
+<change type="feature">
+<para lang="ru">
+поддержка EVFILER_TIMER в MacOSX 10.4.
+</para>
+<para lang="en">
+the EVFILER_TIMER support in MacOSX 10.4.
+</para>
+</change>
+
+<change type="workaround">
+<para lang="ru">
+обход ошибки обработки миллисекундных таймаутов kqueue в 64-битном ядре MacOSX.
+Спасибо Андрею Нигматулину.
+</para>
+<para lang="en">
+for MacOSX 64-bit kernel kqueue millisecond timeout bug.
+Thanks Andrei Nigmatulin.
+</para>
+</change>
+
+<change type="bugfix">
+<para lang="ru">
+если внутри одного сервера описаны несколько директив listen, слушающих на
+разных адресах, то имена серверов вида "*.domain.tld" работали только
+для первого адреса;
+ошибка появилась в 0.3.18.
+</para>
+<para lang="en">
+if there were several "listen" directives listening one various addresses
+inside one server, then server names like "*.domain.tld" worked for first
+address only;
+bug appeared in 0.3.18.
+</para>
+</change>
+
+<change type="bugfix">
+<para lang="ru">
+при использовании протокола HTTPS в директиве proxy_pass не передавались
+запросы с телом, записанным во временный файл.
+</para>
+<para lang="en">
+if the HTTP protocol was used in the "proxy_pass" directive and
+the request body was in temporarily file then the request was not transferred.
+</para>
+</change>
+
+<change type="bugfix">
+<para lang="ru">
+совместимость с perl 5.8.8.
+</para>
+<para lang="en">
+perl 5.8.8 compatibility.
+</para>
+</change>
+
+</changes>
+
+
<changes ver="0.3.30" date="22.02.2006">
<change type="change">
@@ -32,10 +110,12 @@ the ngx_http_ssi_filter_module.
<change type="bugfix">
<para lang="ru">
-nginx не собирался на i386 платформе, если использовался PIC.
+nginx не собирался на i386 платформе, если использовался PIC;
+ошибка появилась в 0.3.27.
</para>
<para lang="en">
-nginx could not be built on i386 platform, if the PIC was used.
+nginx could not be built on i386 platform, if the PIC was used;
+bug appeared in 0.3.27.
</para>
</change>
@@ -225,7 +305,7 @@ directive.
</para>
<para lang="en">
if the HTTP protocol was used in the "proxy_pass" directive then
-the requests with the body did not transferred.
+the requests with the body was not transferred.
</para>
</change>
diff --git a/src/core/nginx.h b/src/core/nginx.h
index d0ff27ffc..e8f60848e 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.30"
+#define NGINX_VER "nginx/0.3.31"
#define NGINX_VAR "NGINX"
#define NGX_OLDPID_EXT ".oldbin"
diff --git a/src/core/ngx_hash.c b/src/core/ngx_hash.c
index 1f677c9fa..2876318a3 100644
--- a/src/core/ngx_hash.c
+++ b/src/core/ngx_hash.c
@@ -741,10 +741,10 @@ ngx_hash_add_key(ngx_hash_keys_arrays_t *ha, ngx_str_t *key, void *value,
ngx_uint_t flags)
{
size_t len;
+ u_char *reverse;
ngx_str_t *name;
ngx_uint_t i, k, n, skip;
ngx_hash_key_t *hk;
- u_char buf[2048];
if (!(flags & NGX_HASH_WILDCARD_KEY)) {
@@ -863,14 +863,19 @@ ngx_hash_add_key(ngx_hash_keys_arrays_t *ha, ngx_str_t *key, void *value,
* and ".example.com" to "com.example\0"
*/
+ reverse = ngx_palloc(ha->temp_pool, key->len);
+ if (reverse == NULL) {
+ return NGX_ERROR;
+ }
+
len = 0;
n = 0;
for (i = key->len - 1; i; i--) {
if (key->data[i] == '.') {
- ngx_memcpy(&buf[n], &key->data[i + 1], len);
+ ngx_memcpy(&reverse[n], &key->data[i + 1], len);
n += len;
- buf[n++] = '.';
+ reverse[n++] = '.';
len = 0;
continue;
}
@@ -879,11 +884,22 @@ ngx_hash_add_key(ngx_hash_keys_arrays_t *ha, ngx_str_t *key, void *value,
}
if (len) {
- ngx_memcpy(&buf[n], &key->data[1], len);
+ ngx_memcpy(&reverse[n], &key->data[1], len);
n += len;
}
- buf[n] = '\0';
+ reverse[n] = '\0';
+
+
+ hk = ngx_array_push(&ha->dns_wildcards);
+ if (hk == NULL) {
+ return NGX_ERROR;
+ }
+
+ hk->key.len = key->len - 1;
+ hk->key.data = reverse;
+ hk->key_hash = 0;
+ hk->value = value;
/* check conflicts in wildcard hash */
@@ -922,20 +938,8 @@ ngx_hash_add_key(ngx_hash_keys_arrays_t *ha, ngx_str_t *key, void *value,
if (name->data == NULL) {
return NGX_ERROR;
}
- ngx_memcpy(name->data, key->data + skip, name->len);
-
-
- ngx_memcpy(key->data, buf, key->len);
- key->len--;
-
- hk = ngx_array_push(&ha->dns_wildcards);
- if (hk == NULL) {
- return NGX_ERROR;
- }
- hk->key = *key;
- hk->key_hash = 0;
- hk->value = value;
+ ngx_memcpy(name->data, key->data + skip, name->len);
}
return NGX_OK;
diff --git a/src/event/modules/ngx_kqueue_module.c b/src/event/modules/ngx_kqueue_module.c
index 88b5b3fd5..f3ca737be 100644
--- a/src/event/modules/ngx_kqueue_module.c
+++ b/src/event/modules/ngx_kqueue_module.c
@@ -490,8 +490,17 @@ ngx_kqueue_process_events(ngx_cycle_t *cycle, ngx_msec_t timer,
tp = NULL;
} else {
+
+ /*
+ * 64-bit MacOSX kernel has the bug: kernel level ts.tv_nsec is
+ * the int32_t while user level ts.tv_nsec is the long (64-bit),
+ * so on the big endian PowerPC all nanoseconds are lost.
+ * NGX_MACOSX_KEVENT_BUG_SHIFT on these machines is "<< 32".
+ */
+
ts.tv_sec = timer / 1000;
- ts.tv_nsec = (timer % 1000) * 1000000;
+ ts.tv_nsec = (long) ((timer % 1000) * 1000000)
+ NGX_MACOSX_KEVENT_BUG_SHIFT;
tp = &ts;
}
diff --git a/src/http/modules/ngx_http_fastcgi_module.c b/src/http/modules/ngx_http_fastcgi_module.c
index 978c32542..715b07020 100644
--- a/src/http/modules/ngx_http_fastcgi_module.c
+++ b/src/http/modules/ngx_http_fastcgi_module.c
@@ -1043,8 +1043,7 @@ ngx_http_fastcgi_process_header(ngx_http_request_t *r)
/* there was error while a header line parsing */
ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
- ngx_http_upstream_header_errors[rc
- - NGX_HTTP_PARSE_HEADER_ERROR]);
+ "upstream sent invalid header");
return NGX_HTTP_UPSTREAM_INVALID_HEADER;
diff --git a/src/http/modules/ngx_http_proxy_module.c b/src/http/modules/ngx_http_proxy_module.c
index e66b48b8b..34e6dd197 100644
--- a/src/http/modules/ngx_http_proxy_module.c
+++ b/src/http/modules/ngx_http_proxy_module.c
@@ -800,9 +800,11 @@ ngx_http_proxy_process_status_line(ngx_http_request_t *r)
ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
"upstream sent no valid HTTP/1.0 header");
+#if 0
if (u->accel) {
return NGX_HTTP_UPSTREAM_INVALID_HEADER;
}
+#endif
r->http_version = NGX_HTTP_VERSION_9;
p->status = NGX_HTTP_OK;
@@ -961,6 +963,10 @@ ngx_http_proxy_parse_status_line(ngx_http_request_t *r, ngx_http_proxy_ctx_t *p)
/* HTTP status code */
case sw_status:
+ if (ch == ' ') {
+ break;
+ }
+
if (ch < '0' || ch > '9') {
return NGX_HTTP_PROXY_PARSE_NO_HEADER;
}
@@ -1111,8 +1117,7 @@ ngx_http_proxy_process_header(ngx_http_request_t *r)
/* there was error while a header line parsing */
ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
- ngx_http_upstream_header_errors[rc
- - NGX_HTTP_PARSE_HEADER_ERROR]);
+ "upstream sent invalid header");
return NGX_HTTP_UPSTREAM_INVALID_HEADER;
}
diff --git a/src/http/modules/perl/Makefile.PL b/src/http/modules/perl/Makefile.PL
index 6fa3df744..48f1ebcd2 100644
--- a/src/http/modules/perl/Makefile.PL
+++ b/src/http/modules/perl/Makefile.PL
@@ -13,6 +13,7 @@ WriteMakefile(
AUTHOR => 'Igor Sysoev',
CCFLAGS => "$ENV{NGX_PERL_CFLAGS}",
+ OPTIMIZE => '-O',
INC => "-I ../../../../../src/core " .
"-I ../../../../../src/event " .
diff --git a/src/http/modules/perl/ngx_http_perl_module.c b/src/http/modules/perl/ngx_http_perl_module.c
index 069c21646..0a982e6e4 100644
--- a/src/http/modules/perl/ngx_http_perl_module.c
+++ b/src/http/modules/perl/ngx_http_perl_module.c
@@ -632,7 +632,7 @@ ngx_http_perl_call_handler(pTHX_ ngx_http_request_t *r, SV *sub,
"call_sv: %d", status);
} else {
- line = POPpx;
+ line = SvPVx(POPs, n_a);
rv->len = n_a;
rv->data = ngx_palloc(r->pool, n_a);
diff --git a/src/http/ngx_http.c b/src/http/ngx_http.c
index 7f19a4347..fb5dcb754 100644
--- a/src/http/ngx_http.c
+++ b/src/http/ngx_http.c
@@ -563,6 +563,8 @@ ngx_http_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
virtual_names:
+ ngx_memzero(&ha, sizeof(ngx_hash_keys_arrays_t));
+
ha.temp_pool = ngx_create_pool(16384, cf->log);
if (ha.temp_pool == NULL) {
return NGX_CONF_ERROR;
@@ -578,6 +580,9 @@ ngx_http_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
name = in_addr[a].names.elts;
for (s = 0; s < in_addr[a].names.nelts; s++) {
+ ngx_log_error(NGX_LOG_ALERT, cf->log, 0,
+ "server name \"%V\"", &name[s].name);
+
ch = name[s].name.data[0];
if (ch == '*' || ch == '.') {
@@ -600,6 +605,9 @@ ngx_http_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
for (s = 0; s < in_addr[a].names.nelts; s++) {
+ ngx_log_error(NGX_LOG_ALERT, cf->log, 0,
+ "wildcard server name \"%V\"", &name[s].name);
+
ch = name[s].name.data[0];
if (ch != '*' && ch != '.') {
diff --git a/src/http/ngx_http_core_module.c b/src/http/ngx_http_core_module.c
index da142c381..26a1d6962 100644
--- a/src/http/ngx_http_core_module.c
+++ b/src/http/ngx_http_core_module.c
@@ -2243,6 +2243,10 @@ ngx_http_core_listen(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
ls->conf.rcvbuf = -1;
ls->conf.sndbuf = -1;
+ if (inet_upstream.host.len == 1 && inet_upstream.host.data[0] == '*') {
+ inet_upstream.host.len = 0;
+ }
+
if (inet_upstream.host.len) {
inet_upstream.host.data[inet_upstream.host.len] = '\0';
diff --git a/src/http/ngx_http_request.h b/src/http/ngx_http_request.h
index facd58ef6..8450b0434 100644
--- a/src/http/ngx_http_request.h
+++ b/src/http/ngx_http_request.h
@@ -37,7 +37,6 @@
#define NGX_HTTP_PARSE_INVALID_REQUEST 11
#define NGX_HTTP_PARSE_INVALID_09_METHOD 12
-#define NGX_HTTP_PARSE_HEADER_ERROR 13
#define NGX_HTTP_PARSE_INVALID_HEADER 13
#define NGX_HTTP_ZERO_IN_URI 1
diff --git a/src/http/ngx_http_upstream.c b/src/http/ngx_http_upstream.c
index e73b3b379..78608181d 100644
--- a/src/http/ngx_http_upstream.c
+++ b/src/http/ngx_http_upstream.c
@@ -259,12 +259,6 @@ static ngx_http_variable_t ngx_http_upstream_vars[] = {
};
-char *ngx_http_upstream_header_errors[] = {
- "upstream sent invalid header",
- "upstream sent too long header line"
-};
-
-
void
ngx_http_upstream_init(ngx_http_request_t *r)
{
@@ -624,6 +618,7 @@ ngx_http_upstream_ssl_init_connection(ngx_http_request_t *r,
}
c->sendfile = 0;
+ u->output.sendfile = 0;
peer = &u->peer.peers->peer[u->peer.cur_peer];
diff --git a/src/http/ngx_http_upstream.h b/src/http/ngx_http_upstream.h
index 1b4795a31..a1780292c 100644
--- a/src/http/ngx_http_upstream.h
+++ b/src/http/ngx_http_upstream.h
@@ -199,7 +199,5 @@ void ngx_http_upstream_init(ngx_http_request_t *r);
extern ngx_module_t ngx_http_upstream_module;
-extern char *ngx_http_upstream_header_errors[];
-
#endif /* _NGX_HTTP_UPSTREAM_H_INCLUDED_ */
diff --git a/src/imap/ngx_imap_core_module.c b/src/imap/ngx_imap_core_module.c
index 44484acc8..c454f1936 100644
--- a/src/imap/ngx_imap_core_module.c
+++ b/src/imap/ngx_imap_core_module.c
@@ -442,6 +442,10 @@ ngx_imap_core_listen(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
return NGX_CONF_ERROR;
}
+ if (inet_upstream.host.len == 1 && inet_upstream.host.data[0] == '*') {
+ inet_upstream.host.len = 0;
+ }
+
if (inet_upstream.host.len) {
inet_upstream.host.data[inet_upstream.host.len] = '\0';