Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

nginx 1.1.1

    *) Change: now cache loader processes either as many files as specified
       by "loader_files" parameter or works no more than time specified by
       "loader_threshold" parameter during each iteration.

    *) Change: now SIGWINCH signal works only in deamon mode.

    *) Feature: now shared zones and caches use POSIX semaphores on
       Solaris.
       Thanks to Den Ivanov.

    *) Feature: accept filters are now supported on NetBSD.

    *) Bugfix: nginx could not be build on Linux 3.0.

    *) Bugfix: nginx did not use gzipping in some cases; the bug had
       appeared in 1.1.0.

    *) Bugfix: request body might be incorrectly processed if client used
       pipelining.

    *) Bugfix: in the "request_body_in_single_buf" directive.

    *) Bugfix: in "proxy_set_body" and "proxy_pass_request_body" directives
       if SSL connection to backend was used.

    *) Bugfix: nginx hogged CPU if all servers in an upstream were marked
       as "down".

    *) Bugfix: a segmentation fault might occur during reconfiguration if
       ssl_session_cache was defined but not used in a previous
       configuration.

    *) Bugfix: a segmentation fault might occur in a worker process if many
       backup servers were used in an upstream.

    *) Bugfix: a segmentation fault might occur in a worker process if
       "fastcgi/scgi/uwsgi_param" directives were used with values starting
       with "HTTP_"; the bug had appeared in 0.8.40.
  • Loading branch information...
commit 22e831ddeb60b36d36db82efd798498b94c7ca8d 1 parent 52eb82f
Igor Sysoev authored committed
Showing with 299 additions and 146 deletions.
  1. +43 −1 CHANGES
  2. +42 −0 CHANGES.ru
  3. +17 −5 auto/cc/sunc
  4. +3 −1 auto/install
  5. +3 −1 auto/os/linux
  6. +36 −0 auto/unix
  7. +10 −0 html/http/ngx_http_core_module.html
  8. +11 −11 man/nginx.8
  9. +2 −2 src/core/nginx.h
  10. +1 −1  src/core/ngx_connection.c
  11. +0 −5 src/core/ngx_cycle.c
  12. +7 −3 src/core/ngx_log.c
  13. +2 −5 src/event/ngx_event_openssl.c
  14. +1 −0  src/event/ngx_event_openssl.h
  15. +9 −1 src/http/modules/ngx_http_fastcgi_module.c
  16. +0 −19 src/http/modules/ngx_http_log_module.c
  17. +1 −2  src/http/modules/ngx_http_proxy_module.c
  18. +1 −1  src/http/modules/ngx_http_referer_module.c
  19. +9 −1 src/http/modules/ngx_http_scgi_module.c
  20. +2 −0  src/http/modules/ngx_http_ssl_module.c
  21. +9 −1 src/http/modules/ngx_http_uwsgi_module.c
  22. +1 −1  src/http/modules/perl/nginx.pm
  23. +37 −28 src/http/ngx_http_core_module.c
  24. +26 −40 src/http/ngx_http_file_cache.c
  25. +4 −1 src/http/ngx_http_request_body.c
  26. +13 −4 src/http/ngx_http_upstream_round_robin.c
  27. +2 −0  src/mail/ngx_mail_ssl_module.c
  28. +0 −5 src/os/unix/ngx_freebsd_config.h
  29. +0 −5 src/os/unix/ngx_linux_config.h
  30. +7 −2 src/os/unix/ngx_process.c
View
44 CHANGES
@@ -1,4 +1,46 @@
+Changes with nginx 1.1.1 22 Aug 2011
+
+ *) Change: now cache loader processes either as many files as specified
+ by "loader_files" parameter or works no more than time specified by
+ "loader_threshold" parameter during each iteration.
+
+ *) Change: now SIGWINCH signal works only in deamon mode.
+
+ *) Feature: now shared zones and caches use POSIX semaphores on
+ Solaris.
+ Thanks to Den Ivanov.
+
+ *) Feature: accept filters are now supported on NetBSD.
+
+ *) Bugfix: nginx could not be build on Linux 3.0.
+
+ *) Bugfix: nginx did not use gzipping in some cases; the bug had
+ appeared in 1.1.0.
+
+ *) Bugfix: request body might be incorrectly processed if client used
+ pipelining.
+
+ *) Bugfix: in the "request_body_in_single_buf" directive.
+
+ *) Bugfix: in "proxy_set_body" and "proxy_pass_request_body" directives
+ if SSL connection to backend was used.
+
+ *) Bugfix: nginx hogged CPU if all servers in an upstream were marked
+ as "down".
+
+ *) Bugfix: a segmentation fault might occur during reconfiguration if
+ ssl_session_cache was defined but not used in a previous
+ configuration.
+
+ *) Bugfix: a segmentation fault might occur in a worker process if many
+ backup servers were used in an upstream.
+
+ *) Bugfix: a segmentation fault might occur in a worker process if
+ "fastcgi/scgi/uwsgi_param" directives were used with values starting
+ with "HTTP_"; the bug had appeared in 0.8.40.
+
+
Changes with nginx 1.1.0 01 Aug 2011
*) Feature: cache loader run time decrease.
@@ -1867,7 +1909,7 @@ Changes with nginx 0.7.15 08 Sep 2008
Changes with nginx 0.7.14 01 Sep 2008
*) Change: now the ssl_certificate and ssl_certificate_key directives
- have not default values.
+ have no default values.
*) Feature: the "listen" directive supports the "ssl" parameter.
View
42 CHANGES.ru
@@ -1,4 +1,46 @@
+Изменения в nginx 1.1.1 22.08.2011
+
+ *) Изменение: теперь загрузчик кэша за каждую итерацию обрабатывает
+ число файлов, указанное в параметре load_files, или же работает не
+ больше времени, указанное в параметре loader_threshold.
+
+ *) Изменение: SIGWINCH сигнал теперь работает только в режиме демона.
+
+ *) Добавление: теперь разделяемые зоны и кэши используют семафоры POSIX
+ на Solaris.
+ Спасибо Денису Иванову.
+
+ *) Добавление: поддержка accept фильтров на NetBSD.
+
+ *) Исправление: nginx не собирался на Linux 3.0.
+
+ *) Исправление: в некоторых случаях nginx не использовал сжатие; ошибка
+ появилась в 1.1.0.
+
+ *) Исправление: обработка тела запроса могло быть неверной, если клиент
+ использовал pipelining.
+
+ *) Исправление: в директиве request_body_in_single_buf.
+
+ *) Исправление: в директивах proxy_set_body и proxy_pass_request_body
+ при использовании SSL соединения с бэкендом.
+
+ *) Исправление: nginx нагружал процессор, если все сервера в upstream'е
+ были отмечены флагом down.
+
+ *) Исправление: при переконфигурации мог произойти segmentation fault,
+ если ssl_session_cache был определён, но не использовался в
+ предыдущей конфигурации.
+
+ *) Исправление: при использовании большого количества backup-серверов в
+ рабочем процессе мог произойти segmentation fault.
+
+ *) Исправление: при использовании директив fastcgi/scgi/uwsgi_param со
+ значением, начинающимся со строки "HTTP_", в рабочем процессе мог
+ произойти segmentation fault; ошибка появилась в 0.8.40.
+
+
Изменения в nginx 1.1.0 01.08.2011
*) Добавление: уменьшение времени работы загрузчика кэша.
View
22 auto/cc/sunc
@@ -6,6 +6,8 @@
# Sun C 5.8 2005/10/13 Sun Studio 11
# Sun C 5.9 SunOS_i386 2007/05/03 Sun Studio 12
# Sun C 5.9 SunOS_sparc 2007/05/03
+# Sun C 5.10 SunOS_i386 2009/06/03 Sun Studio 12.1
+# Sun C 5.11 SunOS_i386 2010/08/13 Sun Studio 12.2
NGX_SUNC_VER=`$CC -V 2>&1 | grep 'Sun C' 2>&1 \
| sed -e 's/^.* Sun C \(.*\)/\1/'`
@@ -57,9 +59,19 @@ esac
# optimizations
+# 20736 == 0x5100, Sun Studio 12.1
+
+if [ "$ngx_sunc_ver" -ge 20736 ]; then
+ ngx_fast="-fast"
+
+else
+ # older versions had problems with bit-fields
+ ngx_fast="-fast -xalias_level=any"
+fi
+
IPO=-xipo
-CFLAGS="$CFLAGS -fast $IPO"
-CORE_LINK="$CORE_LINK -fast $IPO"
+CFLAGS="$CFLAGS $ngx_fast $IPO"
+CORE_LINK="$CORE_LINK $ngx_fast $IPO"
case $CPU in
@@ -126,15 +138,15 @@ CFLAGS="$CFLAGS $CPU_OPT"
if [ ".$PCRE_OPT" = "." ]; then
- PCRE_OPT="-fast $IPO $CPU_OPT"
+ PCRE_OPT="$ngx_fast $IPO $CPU_OPT"
fi
if [ ".$MD5_OPT" = "." ]; then
- MD5_OPT="-fast $IPO $CPU_OPT"
+ MD5_OPT="$ngx_fast $IPO $CPU_OPT"
fi
if [ ".$ZLIB_OPT" = "." ]; then
- ZLIB_OPT="-fast $IPO $CPU_OPT"
+ ZLIB_OPT="$ngx_fast $IPO $CPU_OPT"
fi
View
4 auto/install
@@ -74,7 +74,9 @@ esac
cat << END >> $NGX_MAKEFILE
-manpage:
+manpage: $NGX_OBJS/nginx.8
+
+$NGX_OBJS/nginx.8: man/nginx.8 $NGX_AUTO_CONFIG_H
sed -e "s|%%PREFIX%%|$NGX_PREFIX|" \\
-e "s|%%PID_PATH%%|$NGX_PID_PATH|" \\
-e "s|%%CONF_PATH%%|$NGX_CONF_PATH|" \\
View
4 auto/os/linux
@@ -18,7 +18,9 @@ CC_AUX_FLAGS="$cc_aux_flags -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64"
# Linux kernel version
version=$((`uname -r \
- | sed 's/^\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/\1*256*256+\2*256+\3/'`))
+ | sed -n -e 's/^\([0-9][0-9]*\)\.\([0-9][0-9]*\)\.\([0-9][0-9]*\).*/ \
+ \1*256*256+\2*256+\3/p' \
+ -e 's/^\([0-9][0-9]*\)\.\([0-9][0-9]*\).*/\1*256*256+\2*256/p'`))
version=${version:-0}
View
36 auto/unix
@@ -295,6 +295,7 @@ if [ $ngx_found != yes ]; then
fi
fi
+
ngx_feature="SO_SETFIB"
ngx_feature_name="NGX_HAVE_SETFIB"
ngx_feature_run=no
@@ -305,6 +306,28 @@ ngx_feature_test="setsockopt(0, SOL_SOCKET, SO_SETFIB, NULL, 4)"
. auto/feature
+ngx_feature="SO_ACCEPTFILTER"
+ngx_feature_name="NGX_HAVE_DEFERRED_ACCEPT"
+ngx_feature_run=no
+ngx_feature_incs="#include <sys/socket.h>"
+ngx_feature_path=
+ngx_feature_libs=
+ngx_feature_test="setsockopt(0, SOL_SOCKET, SO_ACCEPTFILTER, NULL, 0)"
+. auto/feature
+
+
+ngx_feature="TCP_DEFER_ACCEPT"
+ngx_feature_name="NGX_HAVE_DEFERRED_ACCEPT"
+ngx_feature_run=no
+ngx_feature_incs="#include <sys/socket.h>
+ #include <netinet/in.h>
+ #include <netinet/tcp.h>"
+ngx_feature_path=
+ngx_feature_libs=
+ngx_feature_test="setsockopt(0, IPPROTO_TCP, TCP_DEFER_ACCEPT, NULL, 0)"
+. auto/feature
+
+
ngx_feature="accept4()"
ngx_feature_name="NGX_HAVE_ACCEPT4"
ngx_feature_run=no
@@ -620,6 +643,19 @@ if [ $ngx_found = no ]; then
fi
+if [ $ngx_found = no ]; then
+
+ # Solaris has POSIX semaphores in librt
+ ngx_feature="POSIX semaphores in librt"
+ ngx_feature_libs=-lrt
+ . auto/feature
+
+ if [ $ngx_found = yes ]; then
+ CORE_LIBS="$CORE_LIBS -lrt"
+ fi
+fi
+
+
ngx_feature="struct msghdr.msg_control"
ngx_feature_name="NGX_HAVE_MSGHDR_MSG_CONTROL"
ngx_feature_run=no
View
10 html/http/ngx_http_core_module.html
@@ -0,0 +1,10 @@
+<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><title>ngx_http_core_module</title></head><body><center><h4>Directives</h4></center><a name="client_body_buffer_size"></a><center><h4>client_body_buffer_size</h4></center>syntax: client_body_buffer_size <i>size</i><br>default: client_body_buffer_size 8k/16k<br>context: http, server, location<br><p>
+Directive sets client request body buffer size.
+If the request body is larger than the buffer,
+then the whole body or some its part is written to temporary file.
+By default buffer size is equal to 2 memory page sizes.
+This is 8K on x86, other 32-bit platforms, and x86-64.
+It is usually 16K on other 64-bit platforms.
+</p><a name="sendfile"></a><center><h4>sendfile</h4></center>syntax: sendfile <i>[on|off]</i><br>default: sendfile off<br>context: http, server, location<br><p>
+Directive enables or disables sendfile() usage.
+</p></body></html>
View
22 man/nginx.8
@@ -24,7 +24,7 @@
.\" SUCH DAMAGE.
.\"
.\"
-.Dd November 14, 2010
+.Dd August 10, 2011
.Dt NGINX 8
.Os
.Sh NAME
@@ -177,25 +177,25 @@ Test configuration file
.Pa ~/mynginx.conf
with global directives for PID and quantity of worker processes.
.Sh SEE ALSO
-.Xr nginx.conf 5
+.\"Xr nginx.conf 5
+.\"Pp
+Documentation at
+.Pa http://nginx.org/
+and
+.Pa http://sysoev.ru/nginx/ .
+.Pp
+For questions and technical support, please refer to
+.Pa http://nginx.org/en/support.html .
.Sh HISTORY
Development of
.Nm
started in 2002, with the first public release on October 4, 2004.
.Sh AUTHORS
+.An -nosplit
.An Igor Sysoev Aq igor@sysoev.ru
.Pp
-Documentation available on
-.Pa http://nginx.org/
-and
-.Pa http://sysoev.ru/nginx/ .
-.Pp
This manual page was written by
.An Sergey A. Osokin Aq osa@FreeBSD.org.ru
as a result of compilation of many
.Nm
documents all over the world.
-.Sh BUGS
-Report to mailing list
-.Aq Li nginx@nginx.org
-if you found one.
View
4 src/core/nginx.h
@@ -8,8 +8,8 @@
#define _NGINX_H_INCLUDED_
-#define nginx_version 1001000
-#define NGINX_VERSION "1.1.0"
+#define nginx_version 1001001
+#define NGINX_VERSION "1.1.1"
#define NGINX_VER "nginx/" NGINX_VERSION
#define NGINX_VAR "NGINX"
View
2  src/core/ngx_connection.c
@@ -580,7 +580,7 @@ ngx_configure_listening_sockets(ngx_cycle_t *cycle)
{
ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno,
"setsockopt(SO_ACCEPTFILTER, \"%s\") "
- " for %V failed, ignored",
+ "for %V failed, ignored",
ls[i].accept_filter, &ls[i].addr_text);
continue;
}
View
5 src/core/ngx_cycle.c
@@ -418,11 +418,6 @@ ngx_init_cycle(ngx_cycle_t *old_cycle)
goto failed;
}
- if (shm_zone[i].init == NULL) {
- /* unused shared zone */
- continue;
- }
-
shm_zone[i].shm.log = cycle->log;
opart = &old_cycle->shared_memory.part;
View
10 src/core/ngx_log.c
@@ -369,12 +369,13 @@ ngx_log_create(ngx_cycle_t *cycle, ngx_str_t *name)
char *
ngx_log_set_levels(ngx_conf_t *cf, ngx_log_t *log)
{
- ngx_uint_t i, n, d;
+ ngx_uint_t i, n, d, found;
ngx_str_t *value;
value = cf->args->elts;
for (i = 2; i < cf->args->nelts; i++) {
+ found = 0;
for (n = 1; n <= NGX_LOG_DEBUG; n++) {
if (ngx_strcmp(value[i].data, err_levels[n].data) == 0) {
@@ -387,7 +388,8 @@ ngx_log_set_levels(ngx_conf_t *cf, ngx_log_t *log)
}
log->log_level = n;
- continue;
+ found = 1;
+ break;
}
}
@@ -401,11 +403,13 @@ ngx_log_set_levels(ngx_conf_t *cf, ngx_log_t *log)
}
log->log_level |= d;
+ found = 1;
+ break;
}
}
- if (log->log_level == 0) {
+ if (!found) {
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
"invalid log level \"%V\"", &value[i]);
return NGX_CONF_ERROR;
View
7 src/event/ngx_event_openssl.c
@@ -26,8 +26,7 @@ static void ngx_ssl_connection_error(ngx_connection_t *c, int sslerr,
ngx_err_t err, char *text);
static void ngx_ssl_clear_error(ngx_log_t *log);
-static ngx_int_t ngx_ssl_session_cache_init(ngx_shm_zone_t *shm_zone,
- void *data);
+ngx_int_t ngx_ssl_session_cache_init(ngx_shm_zone_t *shm_zone, void *data);
static int ngx_ssl_new_session(ngx_ssl_conn_t *ssl_conn,
ngx_ssl_session_t *sess);
static ngx_ssl_session_t *ngx_ssl_get_cached_session(ngx_ssl_conn_t *ssl_conn,
@@ -1505,8 +1504,6 @@ ngx_ssl_session_cache(ngx_ssl_t *ssl, ngx_str_t *sess_ctx,
SSL_CTX_set_timeout(ssl->ctx, (long) timeout);
if (shm_zone) {
- shm_zone->init = ngx_ssl_session_cache_init;
-
SSL_CTX_sess_set_new_cb(ssl->ctx, ngx_ssl_new_session);
SSL_CTX_sess_set_get_cb(ssl->ctx, ngx_ssl_get_cached_session);
SSL_CTX_sess_set_remove_cb(ssl->ctx, ngx_ssl_remove_session);
@@ -1524,7 +1521,7 @@ ngx_ssl_session_cache(ngx_ssl_t *ssl, ngx_str_t *sess_ctx,
}
-static ngx_int_t
+ngx_int_t
ngx_ssl_session_cache_init(ngx_shm_zone_t *shm_zone, void *data)
{
size_t len;
View
1  src/event/ngx_event_openssl.h
@@ -104,6 +104,7 @@ ngx_int_t ngx_ssl_dhparam(ngx_conf_t *cf, ngx_ssl_t *ssl, ngx_str_t *file);
ngx_int_t ngx_ssl_ecdh_curve(ngx_conf_t *cf, ngx_ssl_t *ssl, ngx_str_t *name);
ngx_int_t ngx_ssl_session_cache(ngx_ssl_t *ssl, ngx_str_t *sess_ctx,
ssize_t builtin_session_cache, ngx_shm_zone_t *shm_zone, time_t timeout);
+ngx_int_t ngx_ssl_session_cache_init(ngx_shm_zone_t *shm_zone, void *data);
ngx_int_t ngx_ssl_create_connection(ngx_ssl_t *ssl, ngx_connection_t *c,
ngx_uint_t flags);
View
10 src/http/modules/ngx_http_fastcgi_module.c
@@ -737,7 +737,15 @@ ngx_http_fastcgi_create_request(ngx_http_request_t *r)
lowcase_key = NULL;
if (flcf->header_params) {
- ignored = ngx_palloc(r->pool, flcf->header_params * sizeof(void *));
+ n = 0;
+ part = &r->headers_in.headers.part;
+
+ while (part) {
+ n += part->nelts;
+ part = part->next;
+ }
+
+ ignored = ngx_palloc(r->pool, n * sizeof(void *));
if (ignored == NULL) {
return NGX_ERROR;
}
View
19 src/http/modules/ngx_http_log_module.c
@@ -1055,25 +1055,6 @@ ngx_http_log_compile_format(ngx_conf_t *cf, ngx_array_t *flushes,
for ( /* void */ ; s < args->nelts; s++) {
- for (i = 0; i < value[s].len; i++) {
- if (value[s].data[i] != '%') {
- continue;
- }
-
- ch = value[s].data[i + 1];
-
- if ((ch >= 'A' && ch <= 'Z')
- || (ch >= 'a' && ch <= 'z')
- || ch == '{')
- {
- ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
- "the parameters in the \"%%name\" form are not supported, "
- "use the \"$variable\" instead");
-
- return NGX_CONF_ERROR;
- }
- }
-
i = 0;
while (i < value[s].len) {
View
3  src/http/modules/ngx_http_proxy_module.c
@@ -1132,12 +1132,11 @@ ngx_http_proxy_create_request(ngx_http_request_t *r)
body = body->next;
}
- b->flush = 1;
-
} else {
u->request_bufs = cl;
}
+ b->flush = 1;
cl->next = NULL;
return NGX_OK;
View
2  src/http/modules/ngx_http_referer_module.c
@@ -309,7 +309,7 @@ ngx_http_referer_merge_conf(ngx_conf_t *cf, void *parent, void *child)
hash.key = ngx_hash_key_lc;
hash.max_size = conf->referer_hash_max_size;
hash.bucket_size = conf->referer_hash_bucket_size;
- hash.name = "referers_hash";
+ hash.name = "referer_hash";
hash.pool = cf->pool;
if (conf->keys->keys.nelts) {
View
10 src/http/modules/ngx_http_scgi_module.c
@@ -561,7 +561,15 @@ ngx_http_scgi_create_request(ngx_http_request_t *r)
lowcase_key = NULL;
if (scf->header_params) {
- ignored = ngx_palloc(r->pool, scf->header_params * sizeof(void *));
+ n = 0;
+ part = &r->headers_in.headers.part;
+
+ while (part) {
+ n += part->nelts;
+ part = part->next;
+ }
+
+ ignored = ngx_palloc(r->pool, n * sizeof(void *));
if (ignored == NULL) {
return NGX_ERROR;
}
View
2  src/http/modules/ngx_http_ssl_module.c
@@ -626,6 +626,8 @@ ngx_http_ssl_session_cache(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
sscf->builtin_session_cache = NGX_SSL_NO_BUILTIN_SCACHE;
}
+ sscf->shm_zone->init = ngx_ssl_session_cache_init;
+
return NGX_CONF_OK;
invalid:
View
10 src/http/modules/ngx_http_uwsgi_module.c
@@ -589,7 +589,15 @@ ngx_http_uwsgi_create_request(ngx_http_request_t *r)
lowcase_key = NULL;
if (uwcf->header_params) {
- ignored = ngx_palloc(r->pool, uwcf->header_params * sizeof(void *));
+ n = 0;
+ part = &r->headers_in.headers.part;
+
+ while (part) {
+ n += part->nelts;
+ part = part->next;
+ }
+
+ ignored = ngx_palloc(r->pool, n * sizeof(void *));
if (ignored == NULL) {
return NGX_ERROR;
}
View
2  src/http/modules/perl/nginx.pm
@@ -48,7 +48,7 @@ our @EXPORT = qw(
HTTP_INSUFFICIENT_STORAGE
);
-our $VERSION = '1.1.0';
+our $VERSION = '1.1.1';
require XSLoader;
XSLoader::load('nginx', $VERSION);
View
65 src/http/ngx_http_core_module.c
@@ -71,6 +71,7 @@ static char *ngx_http_core_resolver(ngx_conf_t *cf, ngx_command_t *cmd,
void *conf);
#if (NGX_HTTP_GZIP)
static ngx_int_t ngx_http_gzip_accept_encoding(ngx_str_t *ae);
+static ngx_uint_t ngx_http_gzip_quantity(u_char *p, u_char *last);
static char *ngx_http_gzip_disable(ngx_conf_t *cf, ngx_command_t *cmd,
void *conf);
#endif
@@ -2189,7 +2190,7 @@ ngx_http_gzip_ok(ngx_http_request_t *r)
/*
* gzip is enabled for the following quantities:
- * "gzip; q=0.001" ... "gzip; q=0.999", "gzip; q=1"
+ * "gzip; q=0.001" ... "gzip; q=1.000"
* gzip is disabled for the following quantities:
* "gzip; q=0" ... "gzip; q=0.000", and for any invalid cases
*/
@@ -2197,8 +2198,7 @@ ngx_http_gzip_ok(ngx_http_request_t *r)
static ngx_int_t
ngx_http_gzip_accept_encoding(ngx_str_t *ae)
{
- u_char c, *p, *start, *last;
- ngx_uint_t n, q;
+ u_char *p, *start, *last;
start = ae->data;
last = start + ae->len;
@@ -2255,56 +2255,65 @@ ngx_http_gzip_accept_encoding(ngx_str_t *ae)
return NGX_DECLINED;
}
- c = *p++;
-
- if (c == '1') {
- if (p == last || *p == ',' || *p == ' ') {
- return NGX_OK;
- }
+ if (ngx_http_gzip_quantity(p, last) == 0) {
return NGX_DECLINED;
}
- if (c != '0') {
- return NGX_DECLINED;
+ return NGX_OK;
+}
+
+
+ngx_uint_t
+ngx_http_gzip_quantity(u_char *p, u_char *last)
+{
+ u_char c;
+ ngx_uint_t n, q;
+
+ c = *p++;
+
+ if (c != '0' && c != '1') {
+ return 0;
}
+ q = (c - '0') * 100;
+
if (p == last) {
- return NGX_DECLINED;
+ return q;
}
- if (*p++ != '.') {
- return NGX_DECLINED;
+ c = *p++;
+
+ if (c == ',' || c == ' ') {
+ return q;
+ }
+
+ if (c != '.') {
+ return 0;
}
n = 0;
- q = 0;
while (p < last) {
c = *p++;
- if (c == ',') {
+ if (c == ',' || c == ' ') {
break;
}
- if (c >= '1' && c <= '9') {
+ if (c >= '0' && c <= '9') {
+ q += c - '0';
n++;
- q++;
continue;
}
- if (c == '0') {
- n++;
- continue;
- }
-
- return NGX_DECLINED;
+ return 0;
}
- if (n < 4 && q != 0) {
- return NGX_OK;
+ if (q > 100 || n > 3) {
+ return 0;
}
- return NGX_DECLINED;
+ return q;
}
#endif
@@ -3482,7 +3491,7 @@ ngx_http_core_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
prev->keepalive_header, 0);
ngx_conf_merge_uint_value(conf->keepalive_requests,
prev->keepalive_requests, 100);
- ngx_conf_merge_msec_value(conf->lingering_close,
+ ngx_conf_merge_uint_value(conf->lingering_close,
prev->lingering_close, NGX_HTTP_LINGERING_ON);
ngx_conf_merge_msec_value(conf->lingering_time,
prev->lingering_time, 30000);
View
66 src/http/ngx_http_file_cache.c
@@ -30,8 +30,7 @@ static time_t ngx_http_file_cache_forced_expire(ngx_http_file_cache_t *cache);
static time_t ngx_http_file_cache_expire(ngx_http_file_cache_t *cache);
static void ngx_http_file_cache_delete(ngx_http_file_cache_t *cache,
ngx_queue_t *q, u_char *name);
-static ngx_int_t
- ngx_http_file_cache_loader_sleep(ngx_http_file_cache_t *cache);
+static void ngx_http_file_cache_loader_sleep(ngx_http_file_cache_t *cache);
static ngx_int_t ngx_http_file_cache_noop(ngx_tree_ctx_t *ctx,
ngx_str_t *path);
static ngx_int_t ngx_http_file_cache_manage_file(ngx_tree_ctx_t *ctx,
@@ -1261,12 +1260,28 @@ ngx_http_file_cache_loader(void *data)
static ngx_int_t
-ngx_http_file_cache_loader_sleep(ngx_http_file_cache_t *cache)
+ngx_http_file_cache_noop(ngx_tree_ctx_t *ctx, ngx_str_t *path)
{
- ngx_msec_t elapsed;
+ return NGX_OK;
+}
+
+
+static ngx_int_t
+ngx_http_file_cache_manage_file(ngx_tree_ctx_t *ctx, ngx_str_t *path)
+{
+ ngx_msec_t elapsed;
+ ngx_http_file_cache_t *cache;
+
+ cache = ctx->data;
+
+ if (ngx_http_file_cache_add_file(ctx, path) != NGX_OK) {
+ (void) ngx_http_file_cache_delete_file(ctx, path);
+ }
if (++cache->files >= cache->loader_files) {
+ ngx_http_file_cache_loader_sleep(cache);
+ } else {
ngx_time_update();
elapsed = ngx_abs((ngx_msec_int_t) (ngx_current_msec - cache->last));
@@ -1275,52 +1290,23 @@ ngx_http_file_cache_loader_sleep(ngx_http_file_cache_t *cache)
"http file cache loader time elapsed: %M", elapsed);
if (elapsed >= cache->loader_threshold) {
-
- if (cache->loader_files > 1) {
- cache->loader_files /= 2;
- ngx_log_error(NGX_LOG_NOTICE, ngx_cycle->log, 0,
- "cache %V loader_files decreased to %ui",
- &cache->path->name, cache->loader_files);
-
- } else {
- cache->loader_sleep *= 2;
- ngx_log_error(NGX_LOG_NOTICE, ngx_cycle->log, 0,
- "cache %V loader_sleep increased to %Mms",
- &cache->path->name, cache->loader_sleep);
- }
+ ngx_http_file_cache_loader_sleep(cache);
}
-
- ngx_msleep(cache->loader_sleep);
-
- ngx_time_update();
-
- cache->last = ngx_current_msec;
- cache->files = 0;
}
return (ngx_quit || ngx_terminate) ? NGX_ABORT : NGX_OK;
}
-static ngx_int_t
-ngx_http_file_cache_noop(ngx_tree_ctx_t *ctx, ngx_str_t *path)
-{
- return NGX_OK;
-}
-
-
-static ngx_int_t
-ngx_http_file_cache_manage_file(ngx_tree_ctx_t *ctx, ngx_str_t *path)
+static void
+ngx_http_file_cache_loader_sleep(ngx_http_file_cache_t *cache)
{
- ngx_http_file_cache_t *cache;
-
- cache = ctx->data;
+ ngx_msleep(cache->loader_sleep);
- if (ngx_http_file_cache_add_file(ctx, path) != NGX_OK) {
- (void) ngx_http_file_cache_delete_file(ctx, path);
- }
+ ngx_time_update();
- return ngx_http_file_cache_loader_sleep(cache);
+ cache->last = ngx_current_msec;
+ cache->files = 0;
}
View
5 src/http/ngx_http_request_body.c
@@ -143,6 +143,7 @@ ngx_http_read_client_request_body(ngx_http_request_t *r,
r->header_in->pos += (size_t) r->headers_in.content_length_n;
r->request_length += r->headers_in.content_length_n;
+ b->last = r->header_in->pos;
if (r->request_body_in_file_only) {
if (ngx_http_write_request_body(r, rb->bufs) != NGX_OK) {
@@ -371,7 +372,9 @@ ngx_http_do_read_client_request_body(ngx_http_request_t *r)
}
}
- if (r->request_body_in_file_only && rb->bufs->next) {
+ if (rb->bufs->next
+ && (r->request_body_in_file_only || r->request_body_in_single_buf))
+ {
rb->bufs = rb->bufs->next;
}
View
17 src/http/ngx_http_upstream_round_robin.c
@@ -228,13 +228,18 @@ ngx_http_upstream_init_round_robin_peer(ngx_http_request_t *r,
rrp->peers = us->peer.data;
rrp->current = 0;
- if (rrp->peers->number <= 8 * sizeof(uintptr_t)) {
+ n = rrp->peers->number;
+
+ if (rrp->peers->next && rrp->peers->next->number > n) {
+ n = rrp->peers->next->number;
+ }
+
+ if (n <= 8 * sizeof(uintptr_t)) {
rrp->tried = &rrp->data;
rrp->data = 0;
} else {
- n = (rrp->peers->number + (8 * sizeof(uintptr_t) - 1))
- / (8 * sizeof(uintptr_t));
+ n = (n + (8 * sizeof(uintptr_t) - 1)) / (8 * sizeof(uintptr_t));
rrp->tried = ngx_pcalloc(r->pool, n * sizeof(uintptr_t));
if (rrp->tried == NULL) {
@@ -585,7 +590,7 @@ ngx_http_upstream_get_round_robin_peer(ngx_peer_connection_t *pc, void *data)
static ngx_uint_t
ngx_http_upstream_get_peer(ngx_http_upstream_rr_peers_t *peers)
{
- ngx_uint_t i, n;
+ ngx_uint_t i, n, reset = 0;
ngx_http_upstream_rr_peer_t *peer;
peer = &peers->peer[0];
@@ -624,6 +629,10 @@ ngx_http_upstream_get_peer(ngx_http_upstream_rr_peers_t *peers)
return n;
}
+ if (reset++) {
+ return 0;
+ }
+
for (i = 0; i < peers->number; i++) {
peer[i].current_weight = peer[i].weight;
}
View
2  src/mail/ngx_mail_ssl_module.c
@@ -474,6 +474,8 @@ ngx_mail_ssl_session_cache(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
scf->builtin_session_cache = NGX_SSL_NO_BUILTIN_SCACHE;
}
+ scf->shm_zone->init = ngx_ssl_session_cache_init;
+
return NGX_CONF_OK;
invalid:
View
5 src/os/unix/ngx_freebsd_config.h
@@ -92,11 +92,6 @@ typedef struct aiocb ngx_aiocb_t;
#define NGX_LISTEN_BACKLOG -1
-#if (defined SO_ACCEPTFILTER && !defined NGX_HAVE_DEFERRED_ACCEPT)
-#define NGX_HAVE_DEFERRED_ACCEPT 1
-#endif
-
-
#if (__FreeBSD_version < 430000 || __FreeBSD_version < 500012)
pid_t rfork_thread(int flags, void *stack, int (*func)(void *arg), void *arg);
View
5 src/os/unix/ngx_linux_config.h
@@ -96,11 +96,6 @@ typedef struct iocb ngx_aiocb_t;
#define NGX_LISTEN_BACKLOG 511
-#if defined TCP_DEFER_ACCEPT && !defined NGX_HAVE_DEFERRED_ACCEPT
-#define NGX_HAVE_DEFERRED_ACCEPT 1
-#endif
-
-
#ifndef NGX_HAVE_SO_SNDLOWAT
/* setsockopt(SO_SNDLOWAT) returns ENOPROTOOPT */
#define NGX_HAVE_SO_SNDLOWAT 0
View
9 src/os/unix/ngx_process.c
@@ -339,8 +339,10 @@ ngx_signal_handler(int signo)
break;
case ngx_signal_value(NGX_NOACCEPT_SIGNAL):
- ngx_noaccept = 1;
- action = ", stop accepting connections";
+ if (ngx_daemonized) {
+ ngx_noaccept = 1;
+ action = ", stop accepting connections";
+ }
break;
case ngx_signal_value(NGX_RECONFIGURE_SIGNAL):
@@ -392,6 +394,9 @@ ngx_signal_handler(int signo)
switch (signo) {
case ngx_signal_value(NGX_NOACCEPT_SIGNAL):
+ if (!ngx_daemonized) {
+ break;
+ }
ngx_debug_quit = 1;
case ngx_signal_value(NGX_SHUTDOWN_SIGNAL):
ngx_quit = 1;
Please sign in to comment.
Something went wrong with that request. Please try again.