summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNGINX team <nginx@nginx.org>2012-06-26 13:59:09 +0000
committerJon Kolb <jon@b0g.us>2012-06-26 13:59:09 +0000
commit71bb11df293f3584871a0f7a620f5aae36bf7b66 (patch)
treed148694406c1aa5b31d4262f891200d3bfea4e07
parent35bc6662c0ab8179a462a4d2d45589d982121a06 (diff)
downloadnginx-71bb11df293f3584871a0f7a620f5aae36bf7b66.tar.gz
Changes with nginx 1.3.2 26 Jun 2012v1.3.2
*) Change: the "single" parameter of the "keepalive" directive is now ignored. *) Change: SSL compression is now disabled when using all versions of OpenSSL, including ones prior to 1.0.0. *) Feature: it is now possible to use the "ip_hash" directive to balance IPv6 clients. *) Feature: the $status variable can now be used not only in the "log_format" directive. *) Bugfix: a segmentation fault might occur in a worker process on shutdown if the "resolver" directive was used. *) Bugfix: a segmentation fault might occur in a worker process if the ngx_http_mp4_module was used. *) Bugfix: in the ngx_http_mp4_module. *) Bugfix: a segmentation fault might occur in a worker process if conflicting wildcard server names were used. *) Bugfix: nginx might be terminated abnormally on a SIGBUS signal on ARM platform. *) Bugfix: an alert "sendmsg() failed (9: Bad file number)" on HP-UX while reconfiguration.
-rw-r--r--CHANGES32
-rw-r--r--CHANGES.ru31
-rw-r--r--auto/endianness (renamed from auto/endianess)10
-rw-r--r--auto/lib/google-perftools/conf16
-rw-r--r--auto/modules6
-rw-r--r--auto/os/conf2
-rwxr-xr-xauto/unix2
-rw-r--r--src/core/nginx.h4
-rw-r--r--src/core/ngx_hash.c24
-rw-r--r--src/core/ngx_resolver.c21
-rw-r--r--src/event/ngx_event_openssl.c18
-rw-r--r--src/http/modules/ngx_http_geo_module.c2
-rw-r--r--src/http/modules/ngx_http_log_module.c5
-rw-r--r--src/http/modules/ngx_http_mp4_module.c19
-rw-r--r--src/http/modules/ngx_http_upstream_ip_hash_module.c43
-rw-r--r--src/http/modules/ngx_http_upstream_keepalive_module.c33
-rw-r--r--src/http/modules/perl/nginx.pm2
-rw-r--r--src/http/ngx_http_header_filter_module.c2
-rw-r--r--src/http/ngx_http_request.c2
-rw-r--r--src/http/ngx_http_request.h2
-rw-r--r--src/http/ngx_http_variables.c41
-rw-r--r--src/os/unix/ngx_errno.c2
-rw-r--r--src/os/unix/ngx_errno.h2
-rw-r--r--src/os/unix/ngx_posix_config.h1
-rw-r--r--src/os/unix/ngx_process_cycle.c4
25 files changed, 237 insertions, 89 deletions
diff --git a/CHANGES b/CHANGES
index fdcadfdb5..28cfec81c 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,4 +1,36 @@
+Changes with nginx 1.3.2 26 Jun 2012
+
+ *) Change: the "single" parameter of the "keepalive" directive is now
+ ignored.
+
+ *) Change: SSL compression is now disabled when using all versions of
+ OpenSSL, including ones prior to 1.0.0.
+
+ *) Feature: it is now possible to use the "ip_hash" directive to balance
+ IPv6 clients.
+
+ *) Feature: the $status variable can now be used not only in the
+ "log_format" directive.
+
+ *) Bugfix: a segmentation fault might occur in a worker process on
+ shutdown if the "resolver" directive was used.
+
+ *) Bugfix: a segmentation fault might occur in a worker process if the
+ ngx_http_mp4_module was used.
+
+ *) Bugfix: in the ngx_http_mp4_module.
+
+ *) Bugfix: a segmentation fault might occur in a worker process if
+ conflicting wildcard server names were used.
+
+ *) Bugfix: nginx might be terminated abnormally on a SIGBUS signal on
+ ARM platform.
+
+ *) Bugfix: an alert "sendmsg() failed (9: Bad file number)" on HP-UX
+ while reconfiguration.
+
+
Changes with nginx 1.3.1 05 Jun 2012
*) Security: now nginx/Windows ignores trailing dot in URI path
diff --git a/CHANGES.ru b/CHANGES.ru
index 36c72a124..0869fc498 100644
--- a/CHANGES.ru
+++ b/CHANGES.ru
@@ -1,4 +1,35 @@
+Изменения в nginx 1.3.2 26.06.2012
+
+ *) Изменение: параметр single директивы keepalive теперь игнорируется.
+
+ *) Изменение: сжатие SSL теперь отключено в том числе при использовании
+ OpenSSL cтарее 1.0.0.
+
+ *) Добавление: директиву "ip_hash" теперь можно использовать для
+ балансировки IPv6 клиентов.
+
+ *) Добавление: переменную $status теперь можно использовать не только в
+ директиве log_format.
+
+ *) Исправление: при завершении рабочего процесса мог произойти
+ segmentation fault, если использовалась директива resolver.
+
+ *) Исправление: в рабочем процессе мог произойти segmentation fault,
+ если использовался модуль ngx_http_mp4_module.
+
+ *) Исправление: в модуле ngx_http_mp4_module.
+
+ *) Исправление: в рабочем процессе мог произойти segmentation fault,
+ если использовались конфликтующие имена серверов с масками.
+
+ *) Исправление: на платформе ARM nginx мог аварийно завершаться по
+ сигналу SIGBUS.
+
+ *) Исправление: во время переконфигурации на HP-UX в лог записывался
+ alert "sendmsg() failed (9: Bad file number)".
+
+
Изменения в nginx 1.3.1 05.06.2012
*) Безопасность: теперь nginx/Windows игнорирует точку в конце
diff --git a/auto/endianess b/auto/endianness
index 452dd7c12..87311a0f1 100644
--- a/auto/endianess
+++ b/auto/endianness
@@ -3,9 +3,9 @@
# Copyright (C) Nginx, Inc.
-echo $ngx_n "checking for system endianess ...$ngx_c"
+echo $ngx_n "checking for system byte ordering ...$ngx_c"
echo >> $NGX_ERR
-echo "checking for system endianess" >> $NGX_ERR
+echo "checking for system byte ordering" >> $NGX_ERR
cat << END > $NGX_AUTOTEST.c
@@ -28,10 +28,10 @@ eval "$ngx_test >> $NGX_AUTOCONF_ERR 2>&1"
if [ -x $NGX_AUTOTEST ]; then
if $NGX_AUTOTEST >/dev/null 2>&1; then
- echo " little endianess"
+ echo " little endian"
have=NGX_HAVE_LITTLE_ENDIAN . auto/have
else
- echo " big endianess"
+ echo " big endian"
fi
rm $NGX_AUTOTEST*
@@ -40,6 +40,6 @@ else
rm $NGX_AUTOTEST*
echo
- echo "$0: error: can not detect system endianess"
+ echo "$0: error: cannot detect system byte ordering"
exit 1
fi
diff --git a/auto/lib/google-perftools/conf b/auto/lib/google-perftools/conf
index 398ddd05e..7a9de3002 100644
--- a/auto/lib/google-perftools/conf
+++ b/auto/lib/google-perftools/conf
@@ -29,6 +29,22 @@ if [ $ngx_found = no ]; then
fi
+if [ $ngx_found = no ]; then
+
+ # MacPorts
+
+ ngx_feature="Google perftools in /opt/local/"
+
+ if [ $NGX_RPATH = YES ]; then
+ ngx_feature_libs="-R/opt/local/lib -L/opt/local/lib -lprofiler"
+ else
+ ngx_feature_libs="-L/opt/local/lib -lprofiler"
+ fi
+
+ . auto/feature
+fi
+
+
if [ $ngx_found = yes ]; then
CORE_LIBS="$CORE_LIBS $ngx_feature_libs"
diff --git a/auto/modules b/auto/modules
index ebea30232..2d9da945c 100644
--- a/auto/modules
+++ b/auto/modules
@@ -223,6 +223,7 @@ fi
if [ $HTTP_REALIP = YES ]; then
have=NGX_HTTP_REALIP . auto/have
+ have=NGX_HTTP_X_FORWARDED_FOR . auto/have
HTTP_MODULES="$HTTP_MODULES $HTTP_REALIP_MODULE"
HTTP_SRCS="$HTTP_SRCS $HTTP_REALIP_SRCS"
fi
@@ -233,12 +234,13 @@ if [ $HTTP_STATUS = YES ]; then
fi
if [ $HTTP_GEO = YES ]; then
- have=NGX_HTTP_GEO . auto/have
+ have=NGX_HTTP_X_FORWARDED_FOR . auto/have
HTTP_MODULES="$HTTP_MODULES $HTTP_GEO_MODULE"
HTTP_SRCS="$HTTP_SRCS $HTTP_GEO_SRCS"
fi
if [ $HTTP_GEOIP = YES ]; then
+ have=NGX_HTTP_X_FORWARDED_FOR . auto/have
HTTP_MODULES="$HTTP_MODULES $HTTP_GEOIP_MODULE"
HTTP_SRCS="$HTTP_SRCS $HTTP_GEOIP_SRCS"
fi
@@ -273,7 +275,7 @@ if [ $HTTP_SSL = YES ]; then
fi
if [ $HTTP_PROXY = YES ]; then
- have=NGX_HTTP_PROXY . auto/have
+ have=NGX_HTTP_X_FORWARDED_FOR . auto/have
#USE_MD5=YES
HTTP_MODULES="$HTTP_MODULES $HTTP_PROXY_MODULE"
HTTP_DEPS="$HTTP_DEPS $HTTP_PROXY_DEPS"
diff --git a/auto/os/conf b/auto/os/conf
index 8c18a63fc..fe720160a 100644
--- a/auto/os/conf
+++ b/auto/os/conf
@@ -48,6 +48,7 @@ case "$NGX_PLATFORM" in
CORE_DEPS="$UNIX_DEPS $POSIX_DEPS"
CORE_SRCS="$UNIX_SRCS"
CC_AUX_FLAGS="$CC_AUX_FLAGS -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
+ CC_AUX_FLAGS="$CC_AUX_FLAGS -D_HPUX_ALT_XOPEN_SOCKET_API"
;;
OSF1:*)
@@ -93,6 +94,7 @@ case "$NGX_MACHINE" in
;;
*)
+ have=NGX_ALIGNMENT value=16 . auto/define
NGX_MACH_CACHE_LINE=32
;;
diff --git a/auto/unix b/auto/unix
index 783219e2d..b0a0e4c88 100755
--- a/auto/unix
+++ b/auto/unix
@@ -464,7 +464,7 @@ ngx_type="rlim_t"; ngx_types="int"; . auto/types/typedef
. auto/types/uintptr_t
-. auto/endianess
+. auto/endianness
ngx_type="size_t"; . auto/types/sizeof
ngx_param=NGX_MAX_SIZE_T_VALUE; ngx_value=$ngx_max_value; . auto/types/value
diff --git a/src/core/nginx.h b/src/core/nginx.h
index 4e3a3e518..a0a8141a7 100644
--- a/src/core/nginx.h
+++ b/src/core/nginx.h
@@ -9,8 +9,8 @@
#define _NGINX_H_INCLUDED_
-#define nginx_version 1003001
-#define NGINX_VERSION "1.3.1"
+#define nginx_version 1003002
+#define NGINX_VERSION "1.3.2"
#define NGINX_VER "nginx/" NGINX_VERSION
#define NGINX_VAR "NGINX"
diff --git a/src/core/ngx_hash.c b/src/core/ngx_hash.c
index 7d04f7484..b53294502 100644
--- a/src/core/ngx_hash.c
+++ b/src/core/ngx_hash.c
@@ -924,17 +924,6 @@ wildcard:
}
- hk = ngx_array_push(hwc);
- if (hk == NULL) {
- return NGX_ERROR;
- }
-
- hk->key.len = last - 1;
- hk->key.data = p;
- hk->key_hash = 0;
- hk->value = value;
-
-
/* check conflicts in wildcard hash */
name = keys->elts;
@@ -972,5 +961,18 @@ wildcard:
ngx_memcpy(name->data, key->data + skip, name->len);
+
+ /* add to wildcard hash */
+
+ hk = ngx_array_push(hwc);
+ if (hk == NULL) {
+ return NGX_ERROR;
+ }
+
+ hk->key.len = last - 1;
+ hk->key.data = p;
+ hk->key_hash = 0;
+ hk->value = value;
+
return NGX_OK;
}
diff --git a/src/core/ngx_resolver.c b/src/core/ngx_resolver.c
index 2b0e41a5e..3e75e05a3 100644
--- a/src/core/ngx_resolver.c
+++ b/src/core/ngx_resolver.c
@@ -96,7 +96,7 @@ ngx_resolver_create(ngx_conf_t *cf, ngx_str_t *names, ngx_uint_t n)
{
ngx_str_t s;
ngx_url_t u;
- ngx_uint_t i;
+ ngx_uint_t i, j;
ngx_resolver_t *r;
ngx_pool_cleanup_t *cln;
ngx_udp_connection_t *uc;
@@ -184,16 +184,18 @@ ngx_resolver_create(ngx_conf_t *cf, ngx_str_t *names, ngx_uint_t n)
return NULL;
}
- uc = ngx_array_push(&r->udp_connections);
+ uc = ngx_array_push_n(&r->udp_connections, u.naddrs);
if (uc == NULL) {
return NULL;
}
- ngx_memzero(uc, sizeof(ngx_udp_connection_t));
+ ngx_memzero(uc, u.naddrs * sizeof(ngx_udp_connection_t));
- uc->sockaddr = u.addrs->sockaddr;
- uc->socklen = u.addrs->socklen;
- uc->server = u.addrs->name;
+ for (j = 0; j < u.naddrs; j++) {
+ uc[j].sockaddr = u.addrs[j].sockaddr;
+ uc[j].socklen = u.addrs[j].socklen;
+ uc[j].server = u.addrs[j].name;
+ }
}
return r;
@@ -977,12 +979,11 @@ ngx_resolver_resend(ngx_resolver_t *r, ngx_rbtree_t *tree, ngx_queue_t *queue)
if (rn->waiting) {
- if (ngx_resolver_send_query(r, rn) == NGX_OK) {
+ (void) ngx_resolver_send_query(r, rn);
- rn->expire = now + r->resend_timeout;
+ rn->expire = now + r->resend_timeout;
- ngx_queue_insert_head(queue, &rn->queue);
- }
+ ngx_queue_insert_head(queue, q);
continue;
}
diff --git a/src/event/ngx_event_openssl.c b/src/event/ngx_event_openssl.c
index 30e588c82..4356a05ef 100644
--- a/src/event/ngx_event_openssl.c
+++ b/src/event/ngx_event_openssl.c
@@ -94,6 +94,24 @@ ngx_ssl_init(ngx_log_t *log)
OpenSSL_add_all_algorithms();
+#ifndef SSL_OP_NO_COMPRESSION
+ {
+ /*
+ * Disable gzip compression in OpenSSL prior to 1.0.0 version,
+ * this saves about 522K per connection.
+ */
+ int i, n;
+ STACK_OF(SSL_COMP) *ssl_comp_methods;
+
+ ssl_comp_methods = SSL_COMP_get_compression_methods();
+ n = sk_SSL_COMP_num(ssl_comp_methods);
+
+ for (i = 0; i < n; i++) {
+ (void) sk_SSL_COMP_delete(ssl_comp_methods, i);
+ }
+ }
+#endif
+
ngx_ssl_connection_index = SSL_get_ex_new_index(0, NULL, NULL, NULL, NULL);
if (ngx_ssl_connection_index == -1) {
diff --git a/src/http/modules/ngx_http_geo_module.c b/src/http/modules/ngx_http_geo_module.c
index e792cdb66..189d8ed50 100644
--- a/src/http/modules/ngx_http_geo_module.c
+++ b/src/http/modules/ngx_http_geo_module.c
@@ -145,7 +145,7 @@ typedef struct {
u_char GEORNG[6];
u_char version;
u_char ptr_size;
- uint32_t endianess;
+ uint32_t endianness;
uint32_t crc32;
} ngx_http_geo_header_t;
diff --git a/src/http/modules/ngx_http_log_module.c b/src/http/modules/ngx_http_log_module.c
index b3c9a1126..edb145992 100644
--- a/src/http/modules/ngx_http_log_module.c
+++ b/src/http/modules/ngx_http_log_module.c
@@ -584,10 +584,7 @@ ngx_http_log_status(ngx_http_request_t *r, u_char *buf, ngx_http_log_op_t *op)
status = r->headers_out.status;
} else if (r->http_version == NGX_HTTP_VERSION_9) {
- *buf++ = '0';
- *buf++ = '0';
- *buf++ = '9';
- return buf;
+ status = 9;
} else {
status = 0;
diff --git a/src/http/modules/ngx_http_mp4_module.c b/src/http/modules/ngx_http_mp4_module.c
index 2c8cfd171..d3be23420 100644
--- a/src/http/modules/ngx_http_mp4_module.c
+++ b/src/http/modules/ngx_http_mp4_module.c
@@ -1024,6 +1024,10 @@ ngx_http_mp4_read_moov_atom(ngx_http_mp4_file_t *mp4, uint64_t atom_data_size)
+ NGX_HTTP_MP4_MOOV_BUFFER_EXCESS * no_mdat;
}
+ if (ngx_http_mp4_read(mp4, (size_t) atom_data_size) != NGX_OK) {
+ return NGX_ERROR;
+ }
+
mp4->trak.elts = &mp4->traks;
mp4->trak.size = sizeof(ngx_http_mp4_trak_t);
mp4->trak.nalloc = 2;
@@ -1044,6 +1048,12 @@ ngx_http_mp4_read_moov_atom(ngx_http_mp4_file_t *mp4, uint64_t atom_data_size)
mp4->buffer_start = mp4->buffer_pos;
mp4->buffer_size = NGX_HTTP_MP4_MOOV_BUFFER_EXCESS;
+ if (mp4->buffer_start + mp4->buffer_size > mp4->buffer_end) {
+ mp4->buffer = NULL;
+ mp4->buffer_pos = NULL;
+ mp4->buffer_end = NULL;
+ }
+
} else {
/* skip atoms after moov atom */
mp4->offset = mp4->end;
@@ -2488,7 +2498,13 @@ found:
ngx_mp4_set_32value(entry->chunk, 1);
- if (trak->chunk_samples) {
+ if (trak->chunk_samples && next_chunk - trak->start_chunk == 2) {
+
+ /* last chunk in the entry */
+
+ ngx_mp4_set_32value(entry->samples, samples - trak->chunk_samples);
+
+ } else if (trak->chunk_samples) {
first = &trak->stsc_chunk_entry;
ngx_mp4_set_32value(first->chunk, 1);
@@ -2504,6 +2520,7 @@ found:
ngx_mp4_set_32value(entry->chunk, 2);
+ entries++;
atom_size += sizeof(ngx_mp4_stsc_entry_t);
}
diff --git a/src/http/modules/ngx_http_upstream_ip_hash_module.c b/src/http/modules/ngx_http_upstream_ip_hash_module.c
index 0eadc7d94..89ccc2b85 100644
--- a/src/http/modules/ngx_http_upstream_ip_hash_module.c
+++ b/src/http/modules/ngx_http_upstream_ip_hash_module.c
@@ -16,7 +16,8 @@ typedef struct {
ngx_uint_t hash;
- u_char addr[3];
+ u_char addrlen;
+ u_char *addr;
u_char tries;
@@ -76,7 +77,10 @@ ngx_module_t ngx_http_upstream_ip_hash_module = {
};
-ngx_int_t
+static u_char ngx_http_upstream_ip_hash_pseudo_addr[3];
+
+
+static ngx_int_t
ngx_http_upstream_init_ip_hash(ngx_conf_t *cf, ngx_http_upstream_srv_conf_t *us)
{
if (ngx_http_upstream_init_round_robin(cf, us) != NGX_OK) {
@@ -93,8 +97,10 @@ static ngx_int_t
ngx_http_upstream_init_ip_hash_peer(ngx_http_request_t *r,
ngx_http_upstream_srv_conf_t *us)
{
- u_char *p;
struct sockaddr_in *sin;
+#if (NGX_HAVE_INET6)
+ struct sockaddr_in6 *sin6;
+#endif
ngx_http_upstream_ip_hash_peer_data_t *iphp;
iphp = ngx_palloc(r->pool, sizeof(ngx_http_upstream_ip_hash_peer_data_t));
@@ -110,20 +116,25 @@ ngx_http_upstream_init_ip_hash_peer(ngx_http_request_t *r,
r->upstream->peer.get = ngx_http_upstream_get_ip_hash_peer;
- /* AF_INET only */
-
- if (r->connection->sockaddr->sa_family == AF_INET) {
+ switch (r->connection->sockaddr->sa_family) {
+ case AF_INET:
sin = (struct sockaddr_in *) r->connection->sockaddr;
- p = (u_char *) &sin->sin_addr.s_addr;
- iphp->addr[0] = p[0];
- iphp->addr[1] = p[1];
- iphp->addr[2] = p[2];
-
- } else {
- iphp->addr[0] = 0;
- iphp->addr[1] = 0;
- iphp->addr[2] = 0;
+ iphp->addr = (u_char *) &sin->sin_addr.s_addr;
+ iphp->addrlen = 3;
+ break;
+
+#if (NGX_HAVE_INET6)
+ case AF_INET6:
+ sin6 = (struct sockaddr_in6 *) r->connection->sockaddr;
+ iphp->addr = (u_char *) &sin6->sin6_addr.s6_addr;
+ iphp->addrlen = 16;
+ break;
+#endif
+
+ default:
+ iphp->addr = ngx_http_upstream_ip_hash_pseudo_addr;
+ iphp->addrlen = 3;
}
iphp->hash = 89;
@@ -163,7 +174,7 @@ ngx_http_upstream_get_ip_hash_peer(ngx_peer_connection_t *pc, void *data)
for ( ;; ) {
- for (i = 0; i < 3; i++) {
+ for (i = 0; i < iphp->addrlen; i++) {
hash = (hash * 113 + iphp->addr[i]) % 6271;
}
diff --git a/src/http/modules/ngx_http_upstream_keepalive_module.c b/src/http/modules/ngx_http_upstream_keepalive_module.c
index 6fd9ac70a..d10e3d016 100644
--- a/src/http/modules/ngx_http_upstream_keepalive_module.c
+++ b/src/http/modules/ngx_http_upstream_keepalive_module.c
@@ -12,7 +12,6 @@
typedef struct {
ngx_uint_t max_cached;
- ngx_uint_t single; /* unsigned:1 */
ngx_queue_t cache;
ngx_queue_t free;
@@ -223,36 +222,11 @@ ngx_http_upstream_get_keepalive_peer(ngx_peer_connection_t *pc, void *data)
kp->failed = 0;
- /* single pool of cached connections */
-
- if (kp->conf->single && !ngx_queue_empty(&kp->conf->cache)) {
-
- q = ngx_queue_head(&kp->conf->cache);
-
- item = ngx_queue_data(q, ngx_http_upstream_keepalive_cache_t, queue);
- c = item->connection;
-
- ngx_queue_remove(q);
- ngx_queue_insert_head(&kp->conf->free, q);
-
- ngx_log_debug1(NGX_LOG_DEBUG_HTTP, pc->log, 0,
- "get keepalive peer: using connection %p", c);
-
- c->idle = 0;
- c->log = pc->log;
- c->read->log = pc->log;
- c->write->log = pc->log;
- c->pool->log = pc->log;
-
- pc->connection = c;
- pc->cached = 1;
-
- return NGX_DONE;
- }
+ /* ask balancer */
rc = kp->original_get_peer(pc, kp->data);
- if (kp->conf->single || rc != NGX_OK) {
+ if (rc != NGX_OK) {
return rc;
}
@@ -552,7 +526,8 @@ ngx_http_upstream_keepalive(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
for (i = 2; i < cf->args->nelts; i++) {
if (ngx_strcmp(value[i].data, "single") == 0) {
- kcf->single = 1;
+ ngx_conf_log_error(NGX_LOG_WARN, cf, 0,
+ "the \"single\" parameter is deprecated");
continue;
}
diff --git a/src/http/modules/perl/nginx.pm b/src/http/modules/perl/nginx.pm
index b3f86a809..a71574b7b 100644
--- a/src/http/modules/perl/nginx.pm
+++ b/src/http/modules/perl/nginx.pm
@@ -50,7 +50,7 @@ our @EXPORT = qw(
HTTP_INSUFFICIENT_STORAGE
);
-our $VERSION = '1.3.1';
+our $VERSION = '1.3.2';
require XSLoader;
XSLoader::load('nginx', $VERSION);
diff --git a/src/http/ngx_http_header_filter_module.c b/src/http/ngx_http_header_filter_module.c
index 19f531b5d..1e01c857d 100644
--- a/src/http/ngx_http_header_filter_module.c
+++ b/src/http/ngx_http_header_filter_module.c
@@ -395,7 +395,7 @@ ngx_http_header_filter(ngx_http_request_t *r)
}
} else {
- len += sizeof("Connection: closed" CRLF) - 1;
+ len += sizeof("Connection: close" CRLF) - 1;
}
#if (NGX_HTTP_GZIP)
diff --git a/src/http/ngx_http_request.c b/src/http/ngx_http_request.c
index b1877131c..e0ae5241f 100644
--- a/src/http/ngx_http_request.c
+++ b/src/http/ngx_http_request.c
@@ -138,7 +138,7 @@ ngx_http_header_t ngx_http_headers_in[] = {
{ ngx_string("Keep-Alive"), offsetof(ngx_http_headers_in_t, keep_alive),
ngx_http_process_header_line },
-#if (NGX_HTTP_PROXY || NGX_HTTP_REALIP || NGX_HTTP_GEO)
+#if (NGX_HTTP_X_FORWARDED_FOR)
{ ngx_string("X-Forwarded-For"),
offsetof(ngx_http_headers_in_t, x_forwarded_for),
ngx_http_process_header_line },
diff --git a/src/http/ngx_http_request.h b/src/http/ngx_http_request.h
index 70ca6097e..ec946c5a6 100644
--- a/src/http/ngx_http_request.h
+++ b/src/http/ngx_http_request.h
@@ -192,7 +192,7 @@ typedef struct {
ngx_table_elt_t *keep_alive;
-#if (NGX_HTTP_PROXY || NGX_HTTP_REALIP || NGX_HTTP_GEO)
+#if (NGX_HTTP_X_FORWARDED_FOR)
ngx_table_elt_t *x_forwarded_for;
#endif
diff --git a/src/http/ngx_http_variables.c b/src/http/ngx_http_variables.c
index d9633990c..f34a6d9a3 100644
--- a/src/http/ngx_http_variables.c
+++ b/src/http/ngx_http_variables.c
@@ -77,6 +77,8 @@ static ngx_int_t ngx_http_variable_request_body(ngx_http_request_t *r,
ngx_http_variable_value_t *v, uintptr_t data);
static ngx_int_t ngx_http_variable_request_body_file(ngx_http_request_t *r,
ngx_http_variable_value_t *v, uintptr_t data);
+static ngx_int_t ngx_http_variable_status(ngx_http_request_t *r,
+ ngx_http_variable_value_t *v, uintptr_t data);
static ngx_int_t ngx_http_variable_sent_content_type(ngx_http_request_t *r,
ngx_http_variable_value_t *v, uintptr_t data);
@@ -132,7 +134,7 @@ static ngx_http_variable_t ngx_http_core_variables[] = {
offsetof(ngx_http_request_t, headers_in.via), 0, 0 },
#endif
-#if (NGX_HTTP_PROXY || NGX_HTTP_REALIP)
+#if (NGX_HTTP_X_FORWARDED_FOR)
{ ngx_string("http_x_forwarded_for"), NULL, ngx_http_variable_header,
offsetof(ngx_http_request_t, headers_in.x_forwarded_for), 0, 0 },
#endif
@@ -225,6 +227,10 @@ static ngx_http_variable_t ngx_http_core_variables[] = {
ngx_http_variable_request_body_file,
0, 0, 0 },
+ { ngx_string("status"), NULL,
+ ngx_http_variable_status, 0,
+ NGX_HTTP_VAR_NOCACHEABLE, 0 },
+
{ ngx_string("sent_http_content_type"), NULL,
ngx_http_variable_sent_content_type, 0, 0, 0 },
@@ -1456,6 +1462,39 @@ ngx_http_variable_body_bytes_sent(ngx_http_request_t *r,
static ngx_int_t
+ngx_http_variable_status(ngx_http_request_t *r,
+ ngx_http_variable_value_t *v, uintptr_t data)
+{
+ ngx_uint_t status;
+
+ v->data = ngx_pnalloc(r->pool, NGX_INT_T_LEN);
+ if (v->data == NULL) {
+ return NGX_ERROR;
+ }
+
+ if (r->err_status) {
+ status = r->err_status;
+
+ } else if (r->headers_out.status) {
+ status = r->headers_out.status;
+
+ } else if (r->http_version == NGX_HTTP_VERSION_9) {
+ status = 9;
+
+ } else {
+ status = 0;
+ }
+
+ v->len = ngx_sprintf(v->data, "%03ui", status) - v->data;
+ v->valid = 1;
+ v->no_cacheable = 0;
+ v->not_found = 0;
+
+ return NGX_OK;
+}
+
+
+static ngx_int_t
ngx_http_variable_sent_content_type(ngx_http_request_t *r,
ngx_http_variable_value_t *v, uintptr_t data)
{
diff --git a/src/os/unix/ngx_errno.c b/src/os/unix/ngx_errno.c
index 75176c49a..e787b2377 100644
--- a/src/os/unix/ngx_errno.c
+++ b/src/os/unix/ngx_errno.c
@@ -42,7 +42,7 @@ ngx_strerror(ngx_err_t err, u_char *errstr, size_t size)
}
-ngx_uint_t
+ngx_int_t
ngx_strerror_init(void)
{
char *msg;
diff --git a/src/os/unix/ngx_errno.h b/src/os/unix/ngx_errno.h
index 2912dea04..125087e78 100644
--- a/src/os/unix/ngx_errno.h
+++ b/src/os/unix/ngx_errno.h
@@ -69,7 +69,7 @@ typedef int ngx_err_t;
u_char *ngx_strerror(ngx_err_t err, u_char *errstr, size_t size);
-ngx_uint_t ngx_strerror_init(void);
+ngx_int_t ngx_strerror_init(void);
#endif /* _NGX_ERRNO_H_INCLUDED_ */
diff --git a/src/os/unix/ngx_posix_config.h b/src/os/unix/ngx_posix_config.h
index 4d432a7e3..4cf90cc98 100644
--- a/src/os/unix/ngx_posix_config.h
+++ b/src/os/unix/ngx_posix_config.h
@@ -12,6 +12,7 @@
#if (NGX_HPUX)
#define _XOPEN_SOURCE
#define _XOPEN_SOURCE_EXTENDED 1
+#define _HPUX_ALT_XOPEN_SOCKET_API
#endif
diff --git a/src/os/unix/ngx_process_cycle.c b/src/os/unix/ngx_process_cycle.c
index 82cf8e6ca..0474a26ca 100644
--- a/src/os/unix/ngx_process_cycle.c
+++ b/src/os/unix/ngx_process_cycle.c
@@ -711,6 +711,8 @@ ngx_master_process_exit(ngx_cycle_t *cycle)
ngx_exit_log.file = &ngx_exit_log_file;
ngx_exit_cycle.log = &ngx_exit_log;
+ ngx_exit_cycle.files = ngx_cycle->files;
+ ngx_exit_cycle.files_n = ngx_cycle->files_n;
ngx_cycle = &ngx_exit_cycle;
ngx_destroy_pool(cycle->pool);
@@ -1054,6 +1056,8 @@ ngx_worker_process_exit(ngx_cycle_t *cycle)
ngx_exit_log.file = &ngx_exit_log_file;
ngx_exit_cycle.log = &ngx_exit_log;
+ ngx_exit_cycle.files = ngx_cycle->files;
+ ngx_exit_cycle.files_n = ngx_cycle->files_n;
ngx_cycle = &ngx_exit_cycle;
ngx_destroy_pool(cycle->pool);