summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2011-12-15 15:01:04 +0000
committerJonathan Kolb <jon@b0g.us>2011-12-15 15:01:04 +0000
commitf2c2a6e4941d5b34034167dd4220d22a06908e3b (patch)
tree925b0302c732698f1dad927cb012832ee66f6ca3
parent329a5f241459251c8b5f681aac54db4c5039ec4a (diff)
downloadnginx-1.0.11.tar.gz
Changes with nginx 1.0.11 15 Dec 2011v1.0.11
*) Change: now double quotes are encoded in an "echo" SSI-command output. Thanks to Zaur Abasmirzoev. *) Feature: the "image_filter_sharpen" directive. *) Bugfix: a segmentation fault might occur in a worker process if SNI was used; the bug had appeared in 1.0.9. *) Bugfix: SIGWINCH signal did not work after first binary upgrade; the bug had appeared in 1.0.9. *) Bugfix: the "If-Modified-Since", "If-Range", etc. client request header lines might be passed to backend while caching; or not passed without caching if caching was enabled in another part of the configuration. *) Bugfix: in the "scgi_param" directive, if complex parameters were used. *) Bugfix: "add_header" and "expires" directives did not work if a request was proxied and response status code was 206. *) Bugfix: in the "expires @time" directive. *) Bugfix: in the ngx_http_flv_module. Thanks to Piotr Sikora. *) Bugfix: in the ngx_http_mp4_module. *) Bugfix: nginx could not be built on FreeBSD 10. *) Bugfix: nginx could not be built on AIX. Maxim Dounin _______________________________________________ nginx-announce mailing list nginx-announce@nginx.org http://mailman.nginx.org/mailman/listinfo/nginx-announce
-rw-r--r--CHANGES37
-rw-r--r--CHANGES.ru37
-rw-r--r--auto/install20
-rw-r--r--auto/options77
-rwxr-xr-xauto/unix9
-rw-r--r--conf/mime.types4
-rw-r--r--man/nginx.822
-rw-r--r--src/core/nginx.c50
-rw-r--r--src/core/nginx.h4
-rw-r--r--src/core/ngx_inet.c6
-rw-r--r--src/core/ngx_log.h16
-rw-r--r--src/core/ngx_string.c9
-rw-r--r--src/http/modules/ngx_http_fastcgi_module.c156
-rw-r--r--src/http/modules/ngx_http_flv_module.c2
-rw-r--r--src/http/modules/ngx_http_headers_filter_module.c15
-rw-r--r--src/http/modules/ngx_http_image_filter_module.c82
-rw-r--r--src/http/modules/ngx_http_mp4_module.c2
-rw-r--r--src/http/modules/ngx_http_proxy_module.c61
-rw-r--r--src/http/modules/ngx_http_scgi_module.c156
-rw-r--r--src/http/modules/ngx_http_ssi_filter_module.c4
-rw-r--r--src/http/modules/ngx_http_ssl_module.c2
-rw-r--r--src/http/modules/ngx_http_uwsgi_module.c150
-rw-r--r--src/http/modules/perl/nginx.pm2
-rw-r--r--src/http/ngx_http_core_module.c18
-rw-r--r--src/http/ngx_http_request.c26
-rw-r--r--src/http/ngx_http_upstream.c5
-rw-r--r--src/mail/ngx_mail_auth_http_module.c2
-rw-r--r--src/mail/ngx_mail_proxy_module.c2
-rw-r--r--src/os/unix/ngx_darwin_init.c8
-rw-r--r--src/os/unix/ngx_files.c20
-rw-r--r--src/os/unix/ngx_files.h1
-rw-r--r--src/os/unix/ngx_freebsd_init.c9
32 files changed, 679 insertions, 335 deletions
diff --git a/CHANGES b/CHANGES
index 6589dc014..e2224eb50 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,4 +1,41 @@
+Changes with nginx 1.0.11 15 Dec 2011
+
+ *) Change: now double quotes are encoded in an "echo" SSI-command
+ output.
+ Thanks to Zaur Abasmirzoev.
+
+ *) Feature: the "image_filter_sharpen" directive.
+
+ *) Bugfix: a segmentation fault might occur in a worker process if SNI
+ was used; the bug had appeared in 1.0.9.
+
+ *) Bugfix: SIGWINCH signal did not work after first binary upgrade; the
+ bug had appeared in 1.0.9.
+
+ *) Bugfix: the "If-Modified-Since", "If-Range", etc. client request
+ header lines might be passed to backend while caching; or not passed
+ without caching if caching was enabled in another part of the
+ configuration.
+
+ *) Bugfix: in the "scgi_param" directive, if complex parameters were
+ used.
+
+ *) Bugfix: "add_header" and "expires" directives did not work if a
+ request was proxied and response status code was 206.
+
+ *) Bugfix: in the "expires @time" directive.
+
+ *) Bugfix: in the ngx_http_flv_module.
+ Thanks to Piotr Sikora.
+
+ *) Bugfix: in the ngx_http_mp4_module.
+
+ *) Bugfix: nginx could not be built on FreeBSD 10.
+
+ *) Bugfix: nginx could not be built on AIX.
+
+
Changes with nginx 1.0.10 15 Nov 2011
*) Bugfix: a segmentation fault might occur in a worker process if
diff --git a/CHANGES.ru b/CHANGES.ru
index 1255982f6..3ce4bf91a 100644
--- a/CHANGES.ru
+++ b/CHANGES.ru
@@ -1,4 +1,41 @@
+Изменения в nginx 1.0.11 15.12.2011
+
+ *) Изменение: теперь двойные кавычки экранируется при выводе
+ SSI-командой echo.
+ Спасибо Зауру Абасмирзоеву.
+
+ *) Добавление: директива image_filter_sharpen.
+
+ *) Исправление: в рабочем процессе мог произойти segmentation fault,
+ если использовалось SNI; ошибка появилась в 1.0.9.
+
+ *) Исправление: сигнал SIGWINCH переставал работать после первого
+ обновления исполняемого файла; ошибка появилась в 1.0.9.
+
+ *) Исправление: строки "If-Modified-Since", "If-Range" и им подобные в
+ заголовке запроса клиента могли передаваться бэкенду при кэшировании;
+ или не передаваться при выключенном кэшировании, если кэширование
+ было включено в другой части конфигурации.
+
+ *) Исправление: в директиве scgi_param при использовании составных
+ параметров.
+
+ *) Исправление: директивы add_header и expires не работали для ответов с
+ кодом 206, если запрос проксировался.
+
+ *) Исправление: в директиве "expires @time".
+
+ *) Исправление: в модуле ngx_http_flv_module.
+ Спасибо Piotr Sikora.
+
+ *) Исправление: в модуле ngx_http_mp4_module.
+
+ *) Исправление: nginx не собирался на FreeBSD 10.
+
+ *) Исправление: nginx не собирался на AIX.
+
+
Изменения в nginx 1.0.10 15.11.2011
*) Исправление: в рабочем процессе мог произойти segmentation fault,
diff --git a/auto/install b/auto/install
index 6e8ccda60..d56be27ef 100644
--- a/auto/install
+++ b/auto/install
@@ -72,14 +72,28 @@ case ".$NGX_HTTP_LOG_PATH" in
esac
+if test -e man/nginx.8 ; then
+ NGX_MAN=man/nginx.8
+else
+ NGX_MAN=docs/man/nginx.8
+fi
+
+if test -d html ; then
+ NGX_HTML=html
+else
+ NGX_HTML=docs/html
+fi
+
cat << END >> $NGX_MAKEFILE
-manpage:
+manpage: $NGX_OBJS/nginx.8
+
+$NGX_OBJS/nginx.8: $NGX_MAN $NGX_AUTO_CONFIG_H
sed -e "s|%%PREFIX%%|$NGX_PREFIX|" \\
-e "s|%%PID_PATH%%|$NGX_PID_PATH|" \\
-e "s|%%CONF_PATH%%|$NGX_CONF_PATH|" \\
-e "s|%%ERROR_LOG_PATH%%|${NGX_ERROR_LOG_PATH:-stderr}|" \\
- < man/nginx.8 > $NGX_OBJS/nginx.8
+ < $NGX_MAN > \$@
install: $NGX_OBJS${ngx_dirsep}nginx${ngx_binext} \
$NGX_INSTALL_PERL_MODULES
@@ -133,7 +147,7 @@ install: $NGX_OBJS${ngx_dirsep}nginx${ngx_binext} \
mkdir -p '\$(DESTDIR)`dirname "$NGX_HTTP_LOG_PATH"`'
test -d '\$(DESTDIR)$NGX_PREFIX/html' \
- || cp -r html '\$(DESTDIR)$NGX_PREFIX'
+ || cp -R $NGX_HTML '\$(DESTDIR)$NGX_PREFIX'
END
diff --git a/auto/options b/auto/options
index f30917c89..07d22f519 100644
--- a/auto/options
+++ b/auto/options
@@ -304,21 +304,21 @@ if [ $help = yes ]; then
cat << END
- --help this message
+ --help print this message
- --prefix=PATH set the installation prefix
- --sbin-path=PATH set path to the nginx binary file
- --conf-path=PATH set path to the nginx.conf file
- --error-log-path=PATH set path to the error log
- --pid-path=PATH set path to nginx.pid file
- --lock-path=PATH set path to nginx.lock file
+ --prefix=PATH set installation prefix
+ --sbin-path=PATH set nginx binary pathname
+ --conf-path=PATH set nginx.conf pathname
+ --error-log-path=PATH set error log pathname
+ --pid-path=PATH set nginx.pid pathname
+ --lock-path=PATH set nginx.lock pathname
- --user=USER set non-privilege user
- for the worker processes
- --group=GROUP set non-privilege group
- for the worker processes
+ --user=USER set non-privileged user for
+ worker processes
+ --group=GROUP set non-privileged group for
+ worker processes
- --builddir=DIR set the build directory
+ --builddir=DIR set build directory
--with-rtsig_module enable rtsig module
--with-select_module enable select module
@@ -326,8 +326,8 @@ cat << END
--with-poll_module enable poll module
--without-poll_module disable poll module
- --with-file-aio enable file aio support
- --with-ipv6 enable ipv6 support
+ --with-file-aio enable file AIO support
+ --with-ipv6 enable IPv6 support
--with-http_ssl_module enable ngx_http_ssl_module
--with-http_realip_module enable ngx_http_realip_module
@@ -370,17 +370,20 @@ cat << END
disable ngx_http_upstream_ip_hash_module
--with-http_perl_module enable ngx_http_perl_module
- --with-perl_modules_path=PATH set path to the perl modules
- --with-perl=PATH set path to the perl binary
-
- --http-log-path=PATH set path to the http access log
- --http-client-body-temp-path=PATH set path to the http client request body
- temporary files
- --http-proxy-temp-path=PATH set path to the http proxy temporary files
- --http-fastcgi-temp-path=PATH set path to the http fastcgi temporary
- files
- --http-uwsgi-temp-path=PATH set path to the http uwsgi temporary files
- --http-scgi-temp-path=PATH set path to the http scgi temporary files
+ --with-perl_modules_path=PATH set Perl modules path
+ --with-perl=PATH set perl binary pathname
+
+ --http-log-path=PATH set http access log pathname
+ --http-client-body-temp-path=PATH set path to store
+ http client request body temporary files
+ --http-proxy-temp-path=PATH set path to store
+ http proxy temporary files
+ --http-fastcgi-temp-path=PATH set path to store
+ http fastcgi temporary files
+ --http-uwsgi-temp-path=PATH set path to store
+ http uwsgi temporary files
+ --http-scgi-temp-path=PATH set path to store
+ http scgi temporary files
--without-http disable HTTP server
--without-http-cache disable HTTP cache
@@ -396,40 +399,40 @@ cat << END
--add-module=PATH enable an external module
- --with-cc=PATH set path to C compiler
- --with-cpp=PATH set path to C preprocessor
- --with-cc-opt=OPTIONS set additional options for C compiler
- --with-ld-opt=OPTIONS set additional options for linker
- --with-cpu-opt=CPU build for specified CPU, the valid values:
+ --with-cc=PATH set C compiler pathname
+ --with-cpp=PATH set C preprocessor pathname
+ --with-cc-opt=OPTIONS set additional C compiler options
+ --with-ld-opt=OPTIONS set additional linker options
+ --with-cpu-opt=CPU build for the specified CPU, valid values:
pentium, pentiumpro, pentium3, pentium4,
athlon, opteron, sparc32, sparc64, ppc64
--without-pcre disable PCRE library usage
--with-pcre force PCRE library usage
--with-pcre=DIR set path to PCRE library sources
- --with-pcre-opt=OPTIONS set additional options for PCRE building
+ --with-pcre-opt=OPTIONS set additional build options for PCRE
--with-md5=DIR set path to md5 library sources
- --with-md5-opt=OPTIONS set additional options for md5 building
+ --with-md5-opt=OPTIONS set additional build options for md5
--with-md5-asm use md5 assembler sources
--with-sha1=DIR set path to sha1 library sources
- --with-sha1-opt=OPTIONS set additional options for sha1 building
+ --with-sha1-opt=OPTIONS set additional build options for sha1
--with-sha1-asm use sha1 assembler sources
--with-zlib=DIR set path to zlib library sources
- --with-zlib-opt=OPTIONS set additional options for zlib building
+ --with-zlib-opt=OPTIONS set additional build options for zlib
--with-zlib-asm=CPU use zlib assembler sources optimized
- for specified CPU, the valid values:
+ for the specified CPU, valid values:
pentium, pentiumpro
--with-libatomic force libatomic_ops library usage
--with-libatomic=DIR set path to libatomic_ops library sources
--with-openssl=DIR set path to OpenSSL library sources
- --with-openssl-opt=OPTIONS set additional options for OpenSSL building
+ --with-openssl-opt=OPTIONS set additional build options for OpenSSL
- --with-debug enable the debugging logging
+ --with-debug enable debug logging
END
diff --git a/auto/unix b/auto/unix
index ca533487c..7621e8fa2 100755
--- a/auto/unix
+++ b/auto/unix
@@ -496,7 +496,8 @@ ngx_feature_test="char buf[1]; ssize_t n; n = pwrite(1, buf, 1, 0)"
ngx_feature="sys_nerr"
ngx_feature_name="NGX_SYS_NERR"
ngx_feature_run=value
-ngx_feature_incs='#include <stdio.h>'
+ngx_feature_incs='#include <errno.h>
+ #include <stdio.h>'
ngx_feature_path=
ngx_feature_libs=
ngx_feature_test='printf("%d", sys_nerr);'
@@ -538,10 +539,10 @@ if [ $ngx_found = no ]; then
|| p == NULL
|| strncmp(p, "Unknown error", 13) == 0)
{
- printf("%d", n);
- return 0;
+ break;
}
- }'
+ }
+ printf("%d", n);'
. auto/feature
fi
diff --git a/conf/mime.types b/conf/mime.types
index 24e866e8f..8a218b22a 100644
--- a/conf/mime.types
+++ b/conf/mime.types
@@ -21,7 +21,8 @@ types {
image/x-icon ico;
image/x-jng jng;
image/x-ms-bmp bmp;
- image/svg+xml svg;
+ image/svg+xml svg svgz;
+ image/webp webp;
application/java-archive jar war ear;
application/mac-binhex40 hqx;
@@ -69,6 +70,7 @@ types {
video/mp4 mp4;
video/mpeg mpeg mpg;
video/quicktime mov;
+ video/webm webm;
video/x-flv flv;
video/x-m4v m4v;
video/x-mng mng;
diff --git a/man/nginx.8 b/man/nginx.8
index 4111fe166..aba20c1a3 100644
--- a/man/nginx.8
+++ b/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.
diff --git a/src/core/nginx.c b/src/core/nginx.c
index b8bab37e3..66093f174 100644
--- a/src/core/nginx.c
+++ b/src/core/nginx.c
@@ -203,6 +203,10 @@ main(int argc, char *const *argv)
ngx_cycle_t *cycle, init_cycle;
ngx_core_conf_t *ccf;
+#if (NGX_FREEBSD)
+ ngx_debug_init();
+#endif
+
if (ngx_strerror_init() != NGX_OK) {
return 1;
}
@@ -212,47 +216,49 @@ main(int argc, char *const *argv)
}
if (ngx_show_version) {
- ngx_log_stderr(0, "nginx version: " NGINX_VER);
+ ngx_write_stderr("nginx version: " NGINX_VER NGX_LINEFEED);
if (ngx_show_help) {
- ngx_log_stderr(0,
+ ngx_write_stderr(
"Usage: nginx [-?hvVtq] [-s signal] [-c filename] "
- "[-p prefix] [-g directives]" CRLF CRLF
- "Options:" CRLF
- " -?,-h : this help" CRLF
- " -v : show version and exit" CRLF
+ "[-p prefix] [-g directives]" NGX_LINEFEED
+ NGX_LINEFEED
+ "Options:" NGX_LINEFEED
+ " -?,-h : this help" NGX_LINEFEED
+ " -v : show version and exit" NGX_LINEFEED
" -V : show version and configure options then exit"
- CRLF
- " -t : test configuration and exit" CRLF
+ NGX_LINEFEED
+ " -t : test configuration and exit" NGX_LINEFEED
" -q : suppress non-error messages "
- "during configuration testing" CRLF
+ "during configuration testing" NGX_LINEFEED
" -s signal : send signal to a master process: "
- "stop, quit, reopen, reload" CRLF
+ "stop, quit, reopen, reload" NGX_LINEFEED
#ifdef NGX_PREFIX
" -p prefix : set prefix path (default: "
- NGX_PREFIX ")" CRLF
+ NGX_PREFIX ")" NGX_LINEFEED
#else
- " -p prefix : set prefix path (default: NONE)" CRLF
+ " -p prefix : set prefix path (default: NONE)" NGX_LINEFEED
#endif
" -c filename : set configuration file (default: "
- NGX_CONF_PATH ")" CRLF
+ NGX_CONF_PATH ")" NGX_LINEFEED
" -g directives : set global directives out of configuration "
- "file" CRLF
+ "file" NGX_LINEFEED NGX_LINEFEED
);
}
if (ngx_show_configure) {
+ ngx_write_stderr(
#ifdef NGX_COMPILER
- ngx_log_stderr(0, "built by " NGX_COMPILER);
+ "built by " NGX_COMPILER NGX_LINEFEED
#endif
#if (NGX_SSL)
#ifdef SSL_CTRL_SET_TLSEXT_HOSTNAME
- ngx_log_stderr(0, "TLS SNI support enabled");
+ "TLS SNI support enabled" NGX_LINEFEED
#else
- ngx_log_stderr(0, "TLS SNI support disabled");
+ "TLS SNI support disabled" NGX_LINEFEED
#endif
#endif
- ngx_log_stderr(0, "configure arguments:" NGX_CONFIGURE);
+ "configure arguments:" NGX_CONFIGURE NGX_LINEFEED);
}
if (!ngx_test_config) {
@@ -260,10 +266,6 @@ main(int argc, char *const *argv)
}
}
-#if (NGX_FREEBSD)
- ngx_debug_init();
-#endif
-
/* TODO */ ngx_max_sockets = -1;
ngx_time_init();
@@ -374,6 +376,10 @@ main(int argc, char *const *argv)
ngx_daemonized = 1;
}
+ if (ngx_inherited) {
+ ngx_daemonized = 1;
+ }
+
#endif
if (ngx_create_pidfile(&ccf->pid, cycle->log) != NGX_OK) {
diff --git a/src/core/nginx.h b/src/core/nginx.h
index edec76299..735ad2af6 100644
--- a/src/core/nginx.h
+++ b/src/core/nginx.h
@@ -8,8 +8,8 @@
#define _NGINX_H_INCLUDED_
-#define nginx_version 1000010
-#define NGINX_VERSION "1.0.10"
+#define nginx_version 1000011
+#define NGINX_VERSION "1.0.11"
#define NGINX_VER "nginx/" NGINX_VERSION
#define NGINX_VAR "NGINX"
diff --git a/src/core/ngx_inet.c b/src/core/ngx_inet.c
index ac1ca8bf2..4baa74aee 100644
--- a/src/core/ngx_inet.c
+++ b/src/core/ngx_inet.c
@@ -671,7 +671,7 @@ ngx_parse_inet_url(ngx_pool_t *pool, ngx_url_t *u)
n = ngx_atoi(port, len);
- if (n < 1 || n > 65536) {
+ if (n < 1 || n > 65535) {
u->err = "invalid port";
return NGX_ERROR;
}
@@ -695,7 +695,7 @@ ngx_parse_inet_url(ngx_pool_t *pool, ngx_url_t *u)
if (n != NGX_ERROR) {
- if (n < 1 || n > 65536) {
+ if (n < 1 || n > 65535) {
u->err = "invalid port";
return NGX_ERROR;
}
@@ -835,7 +835,7 @@ ngx_parse_inet6_url(ngx_pool_t *pool, ngx_url_t *u)
n = ngx_atoi(port, len);
- if (n < 1 || n > 65536) {
+ if (n < 1 || n > 65535) {
u->err = "invalid port";
return NGX_ERROR;
}
diff --git a/src/core/ngx_log.h b/src/core/ngx_log.h
index 1054836f1..a55ef449c 100644
--- a/src/core/ngx_log.h
+++ b/src/core/ngx_log.h
@@ -203,6 +203,22 @@ void ngx_cdecl ngx_log_stderr(ngx_err_t err, const char *fmt, ...);
u_char *ngx_log_errno(u_char *buf, u_char *last, ngx_err_t err);
+/*
+ * ngx_write_stderr() cannot be implemented as macro, since
+ * MSVC does not allow to use #ifdef inside macro parameters.
+ *
+ * ngx_write_fd() is used instead of ngx_write_console(), since
+ * CharToOemBuff() inside ngx_write_console() cannot be used with
+ * read only buffer as destination and CharToOemBuff() is not needed
+ * for ngx_write_stderr() anyway.
+ */
+static ngx_inline void
+ngx_write_stderr(char *text)
+{
+ (void) ngx_write_fd(ngx_stderr, text, strlen(text));
+}
+
+
extern ngx_module_t ngx_errlog_module;
extern ngx_uint_t ngx_use_stderr;
diff --git a/src/core/ngx_string.c b/src/core/ngx_string.c
index 29f8e0d67..f5e1d4bf3 100644
--- a/src/core/ngx_string.c
+++ b/src/core/ngx_string.c
@@ -1657,6 +1657,10 @@ ngx_escape_html(u_char *dst, u_char *src, size_t size)
len += sizeof("&amp;") - 2;
break;
+ case '"':
+ len += sizeof("&quot;") - 2;
+ break;
+
default:
break;
}
@@ -1684,6 +1688,11 @@ ngx_escape_html(u_char *dst, u_char *src, size_t size)
*dst++ = ';';
break;
+ case '"':
+ *dst++ = '&'; *dst++ = 'q'; *dst++ = 'u'; *dst++ = 'o';
+ *dst++ = 't'; *dst++ = ';';
+ break;
+
default:
*dst++ = ch;
break;
diff --git a/src/http/modules/ngx_http_fastcgi_module.c b/src/http/modules/ngx_http_fastcgi_module.c
index 48e238cbe..dd555d49d 100644
--- a/src/http/modules/ngx_http_fastcgi_module.c
+++ b/src/http/modules/ngx_http_fastcgi_module.c
@@ -142,6 +142,9 @@ static ngx_int_t ngx_http_fastcgi_add_variables(ngx_conf_t *cf);
static void *ngx_http_fastcgi_create_loc_conf(ngx_conf_t *cf);
static char *ngx_http_fastcgi_merge_loc_conf(ngx_conf_t *cf,
void *parent, void *child);
+static ngx_int_t ngx_http_fastcgi_merge_params(ngx_conf_t *cf,
+ ngx_http_fastcgi_loc_conf_t *conf, ngx_http_fastcgi_loc_conf_t *prev);
+
static ngx_int_t ngx_http_fastcgi_script_name_variable(ngx_http_request_t *r,
ngx_http_variable_value_t *v, uintptr_t data);
static ngx_int_t ngx_http_fastcgi_path_info_variable(ngx_http_request_t *r,
@@ -431,7 +434,7 @@ static ngx_command_t ngx_http_fastcgi_commands[] = {
&ngx_http_upstream_ignore_headers_masks },
{ ngx_string("fastcgi_catch_stderr"),
- NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG,
+ NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
ngx_conf_set_str_array_slot,
NGX_HTTP_LOC_CONF_OFFSET,
offsetof(ngx_http_fastcgi_loc_conf_t, catch_stderr),
@@ -2025,17 +2028,9 @@ ngx_http_fastcgi_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
ngx_http_fastcgi_loc_conf_t *prev = parent;
ngx_http_fastcgi_loc_conf_t *conf = child;
- u_char *p;
size_t size;
- uintptr_t *code;
- ngx_uint_t i;
- ngx_array_t headers_names;
- ngx_keyval_t *src;
- ngx_hash_key_t *hk;
ngx_hash_init_t hash;
ngx_http_core_loc_conf_t *clcf;
- ngx_http_script_compile_t sc;
- ngx_http_script_copy_code_t *copy;
if (conf->upstream.store != 0) {
ngx_conf_merge_value(conf->upstream.store,
@@ -2293,95 +2288,146 @@ ngx_http_fastcgi_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
}
#endif
- if (conf->params_source == NULL) {
- conf->flushes = prev->flushes;
- conf->params_len = prev->params_len;
- conf->params = prev->params;
- conf->params_source = prev->params_source;
- conf->headers_hash = prev->headers_hash;
+ if (ngx_http_fastcgi_merge_params(cf, conf, prev) != NGX_OK) {
+ return NGX_CONF_ERROR;
+ }
-#if (NGX_HTTP_CACHE)
+ return NGX_CONF_OK;
+}
- if (conf->params_source == NULL) {
- if ((conf->upstream.cache == NULL)
- == (prev->upstream.cache == NULL))
- {
- return NGX_CONF_OK;
- }
+static ngx_int_t
+ngx_http_fastcgi_merge_params(ngx_conf_t *cf,
+ ngx_http_fastcgi_loc_conf_t *conf, ngx_http_fastcgi_loc_conf_t *prev)
+{
+ u_char *p;
+ size_t size;
+ uintptr_t *code;
+ ngx_uint_t i, nsrc;
+ ngx_array_t headers_names;
+#if (NGX_HTTP_CACHE)
+ ngx_array_t params_merged;
+#endif
+ ngx_keyval_t *src;
+ ngx_hash_key_t *hk;
+ ngx_hash_init_t hash;
+ ngx_http_script_compile_t sc;
+ ngx_http_script_copy_code_t *copy;
- /* 6 is a number of ngx_http_fastcgi_cache_headers entries */
- conf->params_source = ngx_array_create(cf->pool, 6,
- sizeof(ngx_keyval_t));
- if (conf->params_source == NULL) {
- return NGX_CONF_ERROR;
- }
- }
-#else
+ if (conf->params_source == NULL) {
+ conf->params_source = prev->params_source;
- if (conf->params_source == NULL) {
- return NGX_CONF_OK;
+ if (prev->headers_hash.buckets
+#if (NGX_HTTP_CACHE)
+ && ((conf->upstream.cache == NULL) == (prev->upstream.cache == NULL))
+#endif
+ )
+ {
+ conf->flushes = prev->flushes;
+ conf->params_len = prev->params_len;
+ conf->params = prev->params;
+ conf->headers_hash = prev->headers_hash;
+ conf->header_params = prev->header_params;
+
+ return NGX_OK;
}
+ }
+ if (conf->params_source == NULL
+#if (NGX_HTTP_CACHE)
+ && (conf->upstream.cache == NULL)
#endif
+ )
+ {
+ conf->headers_hash.buckets = (void *) 1;
+ return NGX_OK;
}
conf->params_len = ngx_array_create(cf->pool, 64, 1);
if (conf->params_len == NULL) {
- return NGX_CONF_ERROR;
+ return NGX_ERROR;
}
conf->params = ngx_array_create(cf->pool, 512, 1);
if (conf->params == NULL) {
- return NGX_CONF_ERROR;
+ return NGX_ERROR;
}
if (ngx_array_init(&headers_names, cf->temp_pool, 4, sizeof(ngx_hash_key_t))
!= NGX_OK)
{
- return NGX_CONF_ERROR;
+ return NGX_ERROR;
}
- src = conf->params_source->elts;
+ if (conf->params_source) {
+ src = conf->params_source->elts;
+ nsrc = conf->params_source->nelts;
+
+ } else {
+ src = NULL;
+ nsrc = 0;
+ }
#if (NGX_HTTP_CACHE)
if (conf->upstream.cache) {
ngx_keyval_t *h, *s;
- for (h = ngx_http_fastcgi_cache_headers; h->key.len; h++) {
+ if (ngx_array_init(&params_merged, cf->temp_pool, 4, sizeof(ngx_keyval_t))
+ != NGX_OK)
+ {
+ return NGX_ERROR;
+ }
+
+ for (i = 0; i < nsrc; i++) {
+
+ s = ngx_array_push(&params_merged);
+ if (s == NULL) {
+ return NGX_ERROR;
+ }
+
+ *s = src[i];
+ }
+
+ h = ngx_http_fastcgi_cache_headers;
+
+ while (h->key.len) {
+
+ src = params_merged.elts;
+ nsrc = params_merged.nelts;
- for (i = 0; i < conf->params_source->nelts; i++) {
+ for (i = 0; i < nsrc; i++) {
if (ngx_strcasecmp(h->key.data, src[i].key.data) == 0) {
goto next;
}
}
- s = ngx_array_push(conf->params_source);
+ s = ngx_array_push(&params_merged);
if (s == NULL) {
- return NGX_CONF_ERROR;
+ return NGX_ERROR;
}
*s = *h;
- src = conf->params_source->elts;
-
next:
h++;
}
+
+ src = params_merged.elts;
+ nsrc = params_merged.nelts;
}
#endif
- for (i = 0; i < conf->params_source->nelts; i++) {
+ for (i = 0; i < nsrc; i++) {
if (src[i].key.len > sizeof("HTTP_") - 1
&& ngx_strncmp(src[i].key.data, "HTTP_", sizeof("HTTP_") - 1) == 0)
{
hk = ngx_array_push(&headers_names);
if (hk == NULL) {
- return NGX_CONF_ERROR;
+ return NGX_ERROR;
}
hk->key.len = src[i].key.len - 5;
@@ -2397,7 +2443,7 @@ ngx_http_fastcgi_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
copy = ngx_array_push_n(conf->params_len,
sizeof(ngx_http_script_copy_code_t));
if (copy == NULL) {
- return NGX_CONF_ERROR;
+ return NGX_ERROR;
}
copy->code = (ngx_http_script_code_pt) ngx_http_script_copy_len_code;
@@ -2406,11 +2452,11 @@ ngx_http_fastcgi_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
size = (sizeof(ngx_http_script_copy_code_t)
+ src[i].key.len + sizeof(uintptr_t) - 1)
- & ~(sizeof(uintptr_t) - 1);
+ & ~(sizeof(uintptr_t) - 1);
copy = ngx_array_push_n(conf->params, size);
if (copy == NULL) {
- return NGX_CONF_ERROR;
+ return NGX_ERROR;
}
copy->code = ngx_http_script_copy_code;
@@ -2429,12 +2475,12 @@ ngx_http_fastcgi_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
sc.values = &conf->params;
if (ngx_http_script_compile(&sc) != NGX_OK) {
- return NGX_CONF_ERROR;
+ return NGX_ERROR;
}
code = ngx_array_push_n(conf->params_len, sizeof(uintptr_t));
if (code == NULL) {
- return NGX_CONF_ERROR;
+ return NGX_ERROR;
}
*code = (uintptr_t) NULL;
@@ -2442,7 +2488,7 @@ ngx_http_fastcgi_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
code = ngx_array_push_n(conf->params, sizeof(uintptr_t));
if (code == NULL) {
- return NGX_CONF_ERROR;
+ return NGX_ERROR;
}
*code = (uintptr_t) NULL;
@@ -2450,12 +2496,11 @@ ngx_http_fastcgi_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
code = ngx_array_push_n(conf->params_len, sizeof(uintptr_t));
if (code == NULL) {
- return NGX_CONF_ERROR;
+ return NGX_ERROR;
}
*code = (uintptr_t) NULL;
-
conf->header_params = headers_names.nelts;
hash.hash = &conf->headers_hash;
@@ -2466,12 +2511,7 @@ ngx_http_fastcgi_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
hash.pool = cf->pool;
hash.temp_pool = NULL;
- if (ngx_hash_init(&hash, headers_names.elts, headers_names.nelts) != NGX_OK)
- {
- return NGX_CONF_ERROR;
- }
-
- return NGX_CONF_OK;
+ return ngx_hash_init(&hash, headers_names.elts, headers_names.nelts);
}
diff --git a/src/http/modules/ngx_http_flv_module.c b/src/http/modules/ngx_http_flv_module.c
index 270d969db..30af834ab 100644
--- a/src/http/modules/ngx_http_flv_module.c
+++ b/src/http/modules/ngx_http_flv_module.c
@@ -23,7 +23,7 @@ static ngx_command_t ngx_http_flv_commands[] = {
};
-static u_char ngx_flv_header[] = "FLV\x1\x1\0\0\0\x9\0\0\0\x9";
+static u_char ngx_flv_header[] = "FLV\x1\x5\0\0\0\x9\0\0\0\0";
static ngx_http_module_t ngx_http_flv_module_ctx = {
diff --git a/src/http/modules/ngx_http_headers_filter_module.c b/src/http/modules/ngx_http_headers_filter_module.c
index c3f74ae19..754473355 100644
--- a/src/http/modules/ngx_http_headers_filter_module.c
+++ b/src/http/modules/ngx_http_headers_filter_module.c
@@ -145,6 +145,7 @@ ngx_http_headers_filter(ngx_http_request_t *r)
|| r != r->main
|| (r->headers_out.status != NGX_HTTP_OK
&& r->headers_out.status != NGX_HTTP_NO_CONTENT
+ && r->headers_out.status != NGX_HTTP_PARTIAL_CONTENT
&& r->headers_out.status != NGX_HTTP_MOVED_PERMANENTLY
&& r->headers_out.status != NGX_HTTP_MOVED_TEMPORARILY
&& r->headers_out.status != NGX_HTTP_NOT_MODIFIED))
@@ -253,7 +254,7 @@ ngx_http_set_expires(ngx_http_request_t *r, ngx_http_headers_conf_t *conf)
return NGX_ERROR;
}
- if (conf->expires_time == 0) {
+ if (conf->expires_time == 0 && conf->expires != NGX_HTTP_EXPIRES_DAILY) {
ngx_memcpy(expires->value.data, ngx_cached_http_time.data,
ngx_cached_http_time.len + 1);
ngx_str_set(&cc->value, "max-age=0");
@@ -262,16 +263,16 @@ ngx_http_set_expires(ngx_http_request_t *r, ngx_http_headers_conf_t *conf)
now = ngx_time();
- if (conf->expires == NGX_HTTP_EXPIRES_ACCESS
- || r->headers_out.last_modified_time == -1)
+ if (conf->expires == NGX_HTTP_EXPIRES_DAILY) {
+ expires_time = ngx_next_time(conf->expires_time);
+ max_age = expires_time - now;
+
+ } else if (conf->expires == NGX_HTTP_EXPIRES_ACCESS
+ || r->headers_out.last_modified_time == -1)
{
expires_time = now + conf->expires_time;
max_age = conf->expires_time;
- } else if (conf->expires == NGX_HTTP_EXPIRES_DAILY) {
- expires_time = ngx_next_time(conf->expires_time);
- max_age = expires_time - now;
-
} else {
expires_time = r->headers_out.last_modified_time + conf->expires_time;
max_age = expires_time - now;
diff --git a/src/http/modules/ngx_http_image_filter_module.c b/src/http/modules/ngx_http_image_filter_module.c
index dd3803fe3..66ed34541 100644
--- a/src/http/modules/ngx_http_image_filter_module.c
+++ b/src/http/modules/ngx_http_image_filter_module.c
@@ -41,6 +41,7 @@ typedef struct {
ngx_uint_t height;
ngx_uint_t angle;
ngx_uint_t jpeg_quality;
+ ngx_uint_t sharpen;
ngx_flag_t transparency;
@@ -48,6 +49,7 @@ typedef struct {
ngx_http_complex_value_t *hcv;
ngx_http_complex_value_t *acv;
ngx_http_complex_value_t *jqcv;
+ ngx_http_complex_value_t *shcv;
size_t buffer_size;
} ngx_http_image_filter_conf_t;
@@ -105,13 +107,15 @@ static char *ngx_http_image_filter(ngx_conf_t *cf, ngx_command_t *cmd,
void *conf);
static char *ngx_http_image_filter_jpeg_quality(ngx_conf_t *cf,
ngx_command_t *cmd, void *conf);
+static char *ngx_http_image_filter_sharpen(ngx_conf_t *cf, ngx_command_t *cmd,
+ void *conf);
static ngx_int_t ngx_http_image_filter_init(ngx_conf_t *cf);
static ngx_command_t ngx_http_image_filter_commands[] = {
{ ngx_string("image_filter"),
- NGX_HTTP_LOC_CONF|NGX_CONF_TAKE13|NGX_CONF_TAKE2,
+ NGX_HTTP_LOC_CONF|NGX_CONF_TAKE123,
ngx_http_image_filter,
NGX_HTTP_LOC_CONF_OFFSET,
0,
@@ -124,6 +128,13 @@ static ngx_command_t ngx_http_image_filter_commands[] = {
0,
NULL },
+ { ngx_string("image_filter_sharpen"),
+ NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
+ ngx_http_image_filter_sharpen,
+ NGX_HTTP_LOC_CONF_OFFSET,
+ 0,
+ NULL },
+
{ ngx_string("image_filter_transparency"),
NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG,
ngx_conf_set_flag_slot,
@@ -724,7 +735,7 @@ static ngx_buf_t *
ngx_http_image_resize(ngx_http_request_t *r, ngx_http_image_filter_ctx_t *ctx)
{
int sx, sy, dx, dy, ox, oy, ax, ay, size,
- colors, palette, transparent,
+ colors, palette, transparent, sharpen,
red, green, blue, t;
u_char *out;
ngx_buf_t *b;
@@ -948,6 +959,11 @@ transparent:
gdImageColorTransparent(dst, gdImageColorExact(dst, red, green, blue));
}
+ sharpen = ngx_http_image_filter_get_value(r, conf->shcv, conf->sharpen);
+ if (sharpen > 0) {
+ gdImageSharpen(dst, sharpen);
+ }
+
out = ngx_http_image_out(r, ctx->type, dst, &size);
ngx_log_debug3(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
@@ -1156,6 +1172,7 @@ ngx_http_image_filter_create_conf(ngx_conf_t *cf)
conf->filter = NGX_CONF_UNSET_UINT;
conf->jpeg_quality = NGX_CONF_UNSET_UINT;
+ conf->sharpen = NGX_CONF_UNSET_UINT;
conf->angle = NGX_CONF_UNSET_UINT;
conf->transparency = NGX_CONF_UNSET;
conf->buffer_size = NGX_CONF_UNSET_SIZE;
@@ -1191,6 +1208,12 @@ ngx_http_image_filter_merge_conf(ngx_conf_t *cf, void *parent, void *child)
conf->jqcv = prev->jqcv;
}
+ ngx_conf_merge_uint_value(conf->sharpen, prev->sharpen, 0);
+
+ if (conf->shcv == NULL) {
+ conf->shcv = prev->shcv;
+ }
+
ngx_conf_merge_uint_value(conf->angle, prev->angle, 0);
if (conf->acv == NULL) {
conf->acv = prev->acv;
@@ -1239,7 +1262,11 @@ ngx_http_image_filter(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
} else if (cf->args->nelts == 3) {
if (ngx_strcmp(value[i].data, "rotate") == 0) {
- imcf->filter = NGX_HTTP_IMAGE_ROTATE;
+ if (imcf->filter != NGX_HTTP_IMAGE_RESIZE
+ && imcf->filter != NGX_HTTP_IMAGE_CROP)
+ {
+ imcf->filter = NGX_HTTP_IMAGE_ROTATE;
+ }
ngx_memzero(&ccv, sizeof(ngx_http_compile_complex_value_t));
@@ -1382,7 +1409,7 @@ ngx_http_image_filter_jpeg_quality(ngx_conf_t *cf, ngx_command_t *cmd,
if (n <= 0) {
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
- "invalid parameter \"%V\"", &value[1]);
+ "invalid value \"%V\"", &value[1]);
return NGX_CONF_ERROR;
}
@@ -1401,6 +1428,53 @@ ngx_http_image_filter_jpeg_quality(ngx_conf_t *cf, ngx_command_t *cmd,
}
+static char *
+ngx_http_image_filter_sharpen(ngx_conf_t *cf, ngx_command_t *cmd,
+ void *conf)
+{
+ ngx_http_image_filter_conf_t *imcf = conf;
+
+ ngx_str_t *value;
+ ngx_int_t n;
+ ngx_http_complex_value_t cv;
+ ngx_http_compile_complex_value_t ccv;
+
+ value = cf->args->elts;
+
+ ngx_memzero(&ccv, sizeof(ngx_http_compile_complex_value_t));
+
+ ccv.cf = cf;
+ ccv.value = &value[1];
+ ccv.complex_value = &cv;
+
+ if (ngx_http_compile_complex_value(&ccv) != NGX_OK) {
+ return NGX_CONF_ERROR;
+ }
+
+ if (cv.lengths == NULL) {
+ n = ngx_http_image_filter_value(&value[1]);
+
+ if (n < 0) {
+ ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
+ "invalid value \"%V\"", &value[1]);
+ return NGX_CONF_ERROR;
+ }
+
+ imcf->sharpen = (ngx_uint_t) n;
+
+ } else {
+ imcf->shcv = ngx_palloc(cf->pool, sizeof(ngx_http_complex_value_t));
+ if (imcf->shcv == NULL) {
+ return NGX_CONF_ERROR;
+ }
+
+ *imcf->shcv = cv;
+ }
+
+ return NGX_CONF_OK;
+}
+
+
static ngx_int_t
ngx_http_image_filter_init(ngx_conf_t *cf)
{
diff --git a/src/http/modules/ngx_http_mp4_module.c b/src/http/modules/ngx_http_mp4_module.c
index a4a47ee8e..3c9f88cfc 100644
--- a/src/http/modules/ngx_http_mp4_module.c
+++ b/src/http/modules/ngx_http_mp4_module.c
@@ -1899,7 +1899,7 @@ ngx_http_mp4_update_stts_atom(ngx_http_mp4_file_t *mp4,
ngx_log_debug2(NGX_LOG_DEBUG_HTTP, mp4->file.log, 0,
"count:%uD, duration:%uD", count, duration);
- if (start_time < count * duration) {
+ if (start_time < (uint64_t) count * duration) {
start_sample += (ngx_uint_t) (start_time / duration);
count -= start_sample;
ngx_mp4_set_32value(entry->count, count);
diff --git a/src/http/modules/ngx_http_proxy_module.c b/src/http/modules/ngx_http_proxy_module.c
index 902cfb8f2..64a853c6d 100644
--- a/src/http/modules/ngx_http_proxy_module.c
+++ b/src/http/modules/ngx_http_proxy_module.c
@@ -1722,7 +1722,6 @@ ngx_http_proxy_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
u_char *p;
size_t size;
- ngx_keyval_t *s;
ngx_hash_init_t hash;
ngx_http_core_loc_conf_t *clcf;
ngx_http_proxy_redirect_t *pr;
@@ -2067,22 +2066,6 @@ ngx_http_proxy_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
if (ngx_http_script_compile(&sc) != NGX_OK) {
return NGX_CONF_ERROR;
}
-
- if (conf->headers_source == NULL) {
- conf->headers_source = ngx_array_create(cf->pool, 4,
- sizeof(ngx_keyval_t));
- if (conf->headers_source == NULL) {
- return NGX_CONF_ERROR;
- }
- }
-
- s = ngx_array_push(conf->headers_source);
- if (s == NULL) {
- return NGX_CONF_ERROR;
- }
-
- ngx_str_set(&s->key, "Content-Length");
- ngx_str_set(&s->value, "$proxy_internal_body_length");
}
if (ngx_http_proxy_merge_headers(cf, conf, prev) != NGX_OK) {
@@ -2101,7 +2084,7 @@ ngx_http_proxy_merge_headers(ngx_conf_t *cf, ngx_http_proxy_loc_conf_t *conf,
size_t size;
uintptr_t *code;
ngx_uint_t i;
- ngx_array_t headers_names;
+ ngx_array_t headers_names, headers_merged;
ngx_keyval_t *src, *s, *h;
ngx_hash_key_t *hk;
ngx_hash_init_t hash;
@@ -2117,6 +2100,8 @@ ngx_http_proxy_merge_headers(ngx_conf_t *cf, ngx_http_proxy_loc_conf_t *conf,
}
if (conf->headers_set_hash.buckets
+ && ((conf->body_source.data == NULL)
+ == (prev->body_source.data == NULL))
#if (NGX_HTTP_CACHE)
&& ((conf->upstream.cache == NULL) == (prev->upstream.cache == NULL))
#endif
@@ -2132,6 +2117,12 @@ ngx_http_proxy_merge_headers(ngx_conf_t *cf, ngx_http_proxy_loc_conf_t *conf,
return NGX_ERROR;
}
+ if (ngx_array_init(&headers_merged, cf->temp_pool, 4, sizeof(ngx_keyval_t))
+ != NGX_OK)
+ {
+ return NGX_ERROR;
+ }
+
if (conf->headers_source == NULL) {
conf->headers_source = ngx_array_create(cf->pool, 4,
sizeof(ngx_keyval_t));
@@ -2151,8 +2142,6 @@ ngx_http_proxy_merge_headers(ngx_conf_t *cf, ngx_http_proxy_loc_conf_t *conf,
}
- src = conf->headers_source->elts;
-
#if (NGX_HTTP_CACHE)
h = conf->upstream.cache ? ngx_http_proxy_cache_headers:
@@ -2163,31 +2152,51 @@ ngx_http_proxy_merge_headers(ngx_conf_t *cf, ngx_http_proxy_loc_conf_t *conf,
#endif
+ src = conf->headers_source->elts;
+ for (i = 0; i < conf->headers_source->nelts; i++) {
+
+ s = ngx_array_push(&headers_merged);
+ if (s == NULL) {
+ return NGX_ERROR;
+ }
+
+ *s = src[i];
+ }
+
while (h->key.len) {
- for (i = 0; i < conf->headers_source->nelts; i++) {
+ src = headers_merged.elts;
+ for (i = 0; i < headers_merged.nelts; i++) {
if (ngx_strcasecmp(h->key.data, src[i].key.data) == 0) {
goto next;
}
}
- s = ngx_array_push(conf->headers_source);
+ s = ngx_array_push(&headers_merged);
if (s == NULL) {
return NGX_ERROR;
}
*s = *h;
- src = conf->headers_source->elts;
-
next:
h++;
}
+ if (conf->body_source.data) {
+ s = ngx_array_push(&headers_merged);
+ if (s == NULL) {
+ return NGX_ERROR;
+ }
- src = conf->headers_source->elts;
- for (i = 0; i < conf->headers_source->nelts; i++) {
+ ngx_str_set(&s->key, "Content-Length");
+ ngx_str_set(&s->value, "$proxy_internal_body_length");
+ }
+
+
+ src = headers_merged.elts;
+ for (i = 0; i < headers_merged.nelts; i++) {
hk = ngx_array_push(&headers_names);
if (hk == NULL) {
diff --git a/src/http/modules/ngx_http_scgi_module.c b/src/http/modules/ngx_http_scgi_module.c
index 393edde24..168f497ce 100644
--- a/src/http/modules/ngx_http_scgi_module.c
+++ b/src/http/modules/ngx_http_scgi_module.c
@@ -43,6 +43,8 @@ static void ngx_http_scgi_finalize_request(ngx_http_request_t *r, ngx_int_t rc);
static void *ngx_http_scgi_create_loc_conf(ngx_conf_t *cf);
static char *ngx_http_scgi_merge_loc_conf(ngx_conf_t *cf, void *parent,
void *child);
+static ngx_int_t ngx_http_scgi_merge_params(ngx_conf_t *cf,
+ ngx_http_scgi_loc_conf_t *conf, ngx_http_scgi_loc_conf_t *prev);
static char *ngx_http_scgi_pass(ngx_conf_t *cf, ngx_command_t *cmd, void *conf);
static char *ngx_http_scgi_store(ngx_conf_t *cf, ngx_command_t *cmd,
@@ -556,8 +558,10 @@ ngx_http_scgi_create_request(ngx_http_request_t *r)
while (*(uintptr_t *) le.ip) {
lcode = *(ngx_http_script_len_code_pt *) le.ip;
- len += lcode(&le) + 1;
+ len += lcode(&le);
}
+ len++;
+
le.ip += sizeof(uintptr_t);
}
}
@@ -1059,17 +1063,9 @@ ngx_http_scgi_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
ngx_http_scgi_loc_conf_t *prev = parent;
ngx_http_scgi_loc_conf_t *conf = child;
- u_char *p;
size_t size;
- uintptr_t *code;
- ngx_uint_t i;
- ngx_array_t headers_names;
- ngx_keyval_t *src;
- ngx_hash_key_t *hk;
ngx_hash_init_t hash;
ngx_http_core_loc_conf_t *clcf;
- ngx_http_script_compile_t sc;
- ngx_http_script_copy_code_t *copy;
if (conf->upstream.store != 0) {
ngx_conf_merge_value(conf->upstream.store, prev->upstream.store, 0);
@@ -1307,95 +1303,146 @@ ngx_http_scgi_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
}
}
- if (conf->params_source == NULL) {
- conf->flushes = prev->flushes;
- conf->params_len = prev->params_len;
- conf->params = prev->params;
- conf->params_source = prev->params_source;
- conf->headers_hash = prev->headers_hash;
+ if (ngx_http_scgi_merge_params(cf, conf, prev) != NGX_OK) {
+ return NGX_CONF_ERROR;
+ }
-#if (NGX_HTTP_CACHE)
+ return NGX_CONF_OK;
+}
- if (conf->params_source == NULL) {
- if ((conf->upstream.cache == NULL)
- == (prev->upstream.cache == NULL))
- {
- return NGX_CONF_OK;
- }
+static ngx_int_t
+ngx_http_scgi_merge_params(ngx_conf_t *cf, ngx_http_scgi_loc_conf_t *conf,
+ ngx_http_scgi_loc_conf_t *prev)
+{
+ u_char *p;
+ size_t size;
+ uintptr_t *code;
+ ngx_uint_t i, nsrc;
+ ngx_array_t headers_names;
+#if (NGX_HTTP_CACHE)
+ ngx_array_t params_merged;
+#endif
+ ngx_keyval_t *src;
+ ngx_hash_key_t *hk;
+ ngx_hash_init_t hash;
+ ngx_http_script_compile_t sc;
+ ngx_http_script_copy_code_t *copy;
- /* 6 is a number of ngx_http_scgi_cache_headers entries */
- conf->params_source = ngx_array_create(cf->pool, 6,
- sizeof(ngx_keyval_t));
- if (conf->params_source == NULL) {
- return NGX_CONF_ERROR;
- }
- }
-#else
+ if (conf->params_source == NULL) {
+ conf->params_source = prev->params_source;
+
+ if (prev->headers_hash.buckets
+#if (NGX_HTTP_CACHE)
+ && ((conf->upstream.cache == NULL) == (prev->upstream.cache == NULL))
+#endif
+ )
+ {
+ conf->flushes = prev->flushes;
+ conf->params_len = prev->params_len;
+ conf->params = prev->params;
+ conf->headers_hash = prev->headers_hash;
+ conf->header_params = prev->header_params;
- if (conf->params_source == NULL) {
- return NGX_CONF_OK;
+ return NGX_OK;
}
+ }
+ if (conf->params_source == NULL
+#if (NGX_HTTP_CACHE)
+ && (conf->upstream.cache == NULL)
#endif
+ )
+ {
+ conf->headers_hash.buckets = (void *) 1;
+ return NGX_OK;
}
conf->params_len = ngx_array_create(cf->pool, 64, 1);
if (conf->params_len == NULL) {
- return NGX_CONF_ERROR;
+ return NGX_ERROR;
}
conf->params = ngx_array_create(cf->pool, 512, 1);
if (conf->params == NULL) {
- return NGX_CONF_ERROR;
+ return NGX_ERROR;
}
if (ngx_array_init(&headers_names, cf->temp_pool, 4, sizeof(ngx_hash_key_t))
!= NGX_OK)
{
- return NGX_CONF_ERROR;
+ return NGX_ERROR;
}
- src = conf->params_source->elts;
+ if (conf->params_source) {
+ src = conf->params_source->elts;
+ nsrc = conf->params_source->nelts;
+
+ } else {
+ src = NULL;
+ nsrc = 0;
+ }
#if (NGX_HTTP_CACHE)
if (conf->upstream.cache) {
ngx_keyval_t *h, *s;
- for (h = ngx_http_scgi_cache_headers; h->key.len; h++) {
+ if (ngx_array_init(&params_merged, cf->temp_pool, 4, sizeof(ngx_keyval_t))
+ != NGX_OK)
+ {
+ return NGX_ERROR;
+ }
+
+ for (i = 0; i < nsrc; i++) {
+
+ s = ngx_array_push(&params_merged);
+ if (s == NULL) {
+ return NGX_ERROR;
+ }
+
+ *s = src[i];
+ }
+
+ h = ngx_http_scgi_cache_headers;
- for (i = 0; i < conf->params_source->nelts; i++) {
+ while (h->key.len) {
+
+ src = params_merged.elts;
+ nsrc = params_merged.nelts;
+
+ for (i = 0; i < nsrc; i++) {
if (ngx_strcasecmp(h->key.data, src[i].key.data) == 0) {
goto next;
}
}
- s = ngx_array_push(conf->params_source);
+ s = ngx_array_push(&params_merged);
if (s == NULL) {
- return NGX_CONF_ERROR;
+ return NGX_ERROR;
}
*s = *h;
- src = conf->params_source->elts;
-
next:
h++;
}
+
+ src = params_merged.elts;
+ nsrc = params_merged.nelts;
}
#endif
- for (i = 0; i < conf->params_source->nelts; i++) {
+ for (i = 0; i < nsrc; i++) {
if (src[i].key.len > sizeof("HTTP_") - 1
&& ngx_strncmp(src[i].key.data, "HTTP_", sizeof("HTTP_") - 1) == 0)
{
hk = ngx_array_push(&headers_names);
if (hk == NULL) {
- return NGX_CONF_ERROR;
+ return NGX_ERROR;
}
hk->key.len = src[i].key.len - 5;
@@ -1411,7 +1458,7 @@ ngx_http_scgi_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
copy = ngx_array_push_n(conf->params_len,
sizeof(ngx_http_script_copy_code_t));
if (copy == NULL) {
- return NGX_CONF_ERROR;
+ return NGX_ERROR;
}
copy->code = (ngx_http_script_code_pt) ngx_http_script_copy_len_code;
@@ -1424,7 +1471,7 @@ ngx_http_scgi_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
copy = ngx_array_push_n(conf->params, size);
if (copy == NULL) {
- return NGX_CONF_ERROR;
+ return NGX_ERROR;
}
copy->code = ngx_http_script_copy_code;
@@ -1443,12 +1490,12 @@ ngx_http_scgi_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
sc.values = &conf->params;
if (ngx_http_script_compile(&sc) != NGX_OK) {
- return NGX_CONF_ERROR;
+ return NGX_ERROR;
}
code = ngx_array_push_n(conf->params_len, sizeof(uintptr_t));
if (code == NULL) {
- return NGX_CONF_ERROR;
+ return NGX_ERROR;
}
*code = (uintptr_t) NULL;
@@ -1456,7 +1503,7 @@ ngx_http_scgi_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
code = ngx_array_push_n(conf->params, sizeof(uintptr_t));
if (code == NULL) {
- return NGX_CONF_ERROR;
+ return NGX_ERROR;
}
*code = (uintptr_t) NULL;
@@ -1464,14 +1511,14 @@ ngx_http_scgi_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
code = ngx_array_push_n(conf->params_len, sizeof(uintptr_t));
if (code == NULL) {
- return NGX_CONF_ERROR;
+ return NGX_ERROR;
}
*code = (uintptr_t) NULL;
code = ngx_array_push_n(conf->params, sizeof(uintptr_t));
if (code == NULL) {
- return NGX_CONF_ERROR;
+ return NGX_ERROR;
}
*code = (uintptr_t) NULL;
@@ -1486,12 +1533,7 @@ ngx_http_scgi_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
hash.pool = cf->pool;
hash.temp_pool = NULL;
- if (ngx_hash_init(&hash, headers_names.elts, headers_names.nelts) != NGX_OK)
- {
- return NGX_CONF_ERROR;
- }
-
- return NGX_CONF_OK;
+ return ngx_hash_init(&hash, headers_names.elts, headers_names.nelts);
}
diff --git a/src/http/modules/ngx_http_ssi_filter_module.c b/src/http/modules/ngx_http_ssi_filter_module.c
index 75a7156ef..0b8bc9bf8 100644
--- a/src/http/modules/ngx_http_ssi_filter_module.c
+++ b/src/http/modules/ngx_http_ssi_filter_module.c
@@ -139,14 +139,14 @@ static ngx_command_t ngx_http_ssi_filter_commands[] = {
NULL },
{ ngx_string("ssi_min_file_chunk"),
- NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG,
+ NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
ngx_conf_set_size_slot,
NGX_HTTP_LOC_CONF_OFFSET,
offsetof(ngx_http_ssi_loc_conf_t, min_file_chunk),
NULL },
{ ngx_string("ssi_value_length"),
- NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG,
+ NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
ngx_conf_set_size_slot,
NGX_HTTP_LOC_CONF_OFFSET,
offsetof(ngx_http_ssi_loc_conf_t, value_len),
diff --git a/src/http/modules/ngx_http_ssl_module.c b/src/http/modules/ngx_http_ssl_module.c
index f1f6a4ae4..0ac744ca1 100644
--- a/src/http/modules/ngx_http_ssl_module.c
+++ b/src/http/modules/ngx_http_ssl_module.c
@@ -101,7 +101,7 @@ static ngx_command_t ngx_http_ssl_commands[] = {
NULL },
{ ngx_string("ssl_verify_client"),
- NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_CONF_FLAG,
+ NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_CONF_TAKE1,
ngx_conf_set_enum_slot,
NGX_HTTP_SRV_CONF_OFFSET,
offsetof(ngx_http_ssl_srv_conf_t, verify),
diff --git a/src/http/modules/ngx_http_uwsgi_module.c b/src/http/modules/ngx_http_uwsgi_module.c
index 9cf0b531a..d60812932 100644
--- a/src/http/modules/ngx_http_uwsgi_module.c
+++ b/src/http/modules/ngx_http_uwsgi_module.c
@@ -50,6 +50,8 @@ static void ngx_http_uwsgi_finalize_request(ngx_http_request_t *r,
static void *ngx_http_uwsgi_create_loc_conf(ngx_conf_t *cf);
static char *ngx_http_uwsgi_merge_loc_conf(ngx_conf_t *cf, void *parent,
void *child);
+static ngx_int_t ngx_http_uwsgi_merge_params(ngx_conf_t *cf,
+ ngx_http_uwsgi_loc_conf_t *conf, ngx_http_uwsgi_loc_conf_t *prev);
static char *ngx_http_uwsgi_pass(ngx_conf_t *cf, ngx_command_t *cmd,
void *conf);
@@ -1112,17 +1114,9 @@ ngx_http_uwsgi_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
ngx_http_uwsgi_loc_conf_t *prev = parent;
ngx_http_uwsgi_loc_conf_t *conf = child;
- u_char *p;
size_t size;
- uintptr_t *code;
- ngx_uint_t i;
- ngx_array_t headers_names;
- ngx_keyval_t *src;
- ngx_hash_key_t *hk;
ngx_hash_init_t hash;
ngx_http_core_loc_conf_t *clcf;
- ngx_http_script_compile_t sc;
- ngx_http_script_copy_code_t *copy;
if (conf->upstream.store != 0) {
ngx_conf_merge_value(conf->upstream.store, prev->upstream.store, 0);
@@ -1365,95 +1359,146 @@ ngx_http_uwsgi_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
ngx_conf_merge_uint_value(conf->modifier1, prev->modifier1, 0);
ngx_conf_merge_uint_value(conf->modifier2, prev->modifier2, 0);
- if (conf->params_source == NULL) {
- conf->flushes = prev->flushes;
- conf->params_len = prev->params_len;
- conf->params = prev->params;
- conf->params_source = prev->params_source;
- conf->headers_hash = prev->headers_hash;
+ if (ngx_http_uwsgi_merge_params(cf, conf, prev) != NGX_OK) {
+ return NGX_CONF_ERROR;
+ }
-#if (NGX_HTTP_CACHE)
+ return NGX_CONF_OK;
+}
- if (conf->params_source == NULL) {
- if ((conf->upstream.cache == NULL)
- == (prev->upstream.cache == NULL))
- {
- return NGX_CONF_OK;
- }
+static ngx_int_t
+ngx_http_uwsgi_merge_params(ngx_conf_t *cf, ngx_http_uwsgi_loc_conf_t *conf,
+ ngx_http_uwsgi_loc_conf_t *prev)
+{
+ u_char *p;
+ size_t size;
+ uintptr_t *code;
+ ngx_uint_t i, nsrc;
+ ngx_array_t headers_names;
+#if (NGX_HTTP_CACHE)
+ ngx_array_t params_merged;
+#endif
+ ngx_keyval_t *src;
+ ngx_hash_key_t *hk;
+ ngx_hash_init_t hash;
+ ngx_http_script_compile_t sc;
+ ngx_http_script_copy_code_t *copy;
- /* 6 is a number of ngx_http_uwsgi_cache_headers entries */
- conf->params_source = ngx_array_create(cf->pool, 6,
- sizeof(ngx_keyval_t));
- if (conf->params_source == NULL) {
- return NGX_CONF_ERROR;
- }
- }
-#else
+ if (conf->params_source == NULL) {
+ conf->params_source = prev->params_source;
- if (conf->params_source == NULL) {
- return NGX_CONF_OK;
+ if (prev->headers_hash.buckets
+#if (NGX_HTTP_CACHE)
+ && ((conf->upstream.cache == NULL) == (prev->upstream.cache == NULL))
+#endif
+ )
+ {
+ conf->flushes = prev->flushes;
+ conf->params_len = prev->params_len;
+ conf->params = prev->params;
+ conf->headers_hash = prev->headers_hash;
+ conf->header_params = prev->header_params;
+
+ return NGX_OK;
}
+ }
+ if (conf->params_source == NULL
+#if (NGX_HTTP_CACHE)
+ && (conf->upstream.cache == NULL)
#endif
+ )
+ {
+ conf->headers_hash.buckets = (void *) 1;
+ return NGX_OK;
}
conf->params_len = ngx_array_create(cf->pool, 64, 1);
if (conf->params_len == NULL) {
- return NGX_CONF_ERROR;
+ return NGX_ERROR;
}
conf->params = ngx_array_create(cf->pool, 512, 1);
if (conf->params == NULL) {
- return NGX_CONF_ERROR;
+ return NGX_ERROR;
}
if (ngx_array_init(&headers_names, cf->temp_pool, 4, sizeof(ngx_hash_key_t))
!= NGX_OK)
{
- return NGX_CONF_ERROR;
+ return NGX_ERROR;
}
- src = conf->params_source->elts;
+ if (conf->params_source) {
+ src = conf->params_source->elts;
+ nsrc = conf->params_source->nelts;
+
+ } else {
+ src = NULL;
+ nsrc = 0;
+ }
#if (NGX_HTTP_CACHE)
if (conf->upstream.cache) {
ngx_keyval_t *h, *s;
- for (h = ngx_http_uwsgi_cache_headers; h->key.len; h++) {
+ if (ngx_array_init(&params_merged, cf->temp_pool, 4, sizeof(ngx_keyval_t))
+ != NGX_OK)
+ {
+ return NGX_ERROR;
+ }
+
+ for (i = 0; i < nsrc; i++) {
+
+ s = ngx_array_push(&params_merged);
+ if (s == NULL) {
+ return NGX_ERROR;
+ }
+
+ *s = src[i];
+ }
- for (i = 0; i < conf->params_source->nelts; i++) {
+ h = ngx_http_uwsgi_cache_headers;
+
+ while (h->key.len) {
+
+ src = params_merged.elts;
+ nsrc = params_merged.nelts;
+
+ for (i = 0; i < nsrc; i++) {
if (ngx_strcasecmp(h->key.data, src[i].key.data) == 0) {
goto next;
}
}
- s = ngx_array_push(conf->params_source);
+ s = ngx_array_push(&params_merged);
if (s == NULL) {
- return NGX_CONF_ERROR;
+ return NGX_ERROR;
}
*s = *h;
- src = conf->params_source->elts;
-
next:
h++;
}
+
+ src = params_merged.elts;
+ nsrc = params_merged.nelts;
}
#endif
- for (i = 0; i < conf->params_source->nelts; i++) {
+ for (i = 0; i < nsrc; i++) {
if (src[i].key.len > sizeof("HTTP_") - 1
&& ngx_strncmp(src[i].key.data, "HTTP_", sizeof("HTTP_") - 1) == 0)
{
hk = ngx_array_push(&headers_names);
if (hk == NULL) {
- return NGX_CONF_ERROR;
+ return NGX_ERROR;
}
hk->key.len = src[i].key.len - 5;
@@ -1469,7 +1514,7 @@ ngx_http_uwsgi_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
copy = ngx_array_push_n(conf->params_len,
sizeof(ngx_http_script_copy_code_t));
if (copy == NULL) {
- return NGX_CONF_ERROR;
+ return NGX_ERROR;
}
copy->code = (ngx_http_script_code_pt) ngx_http_script_copy_len_code;
@@ -1482,7 +1527,7 @@ ngx_http_uwsgi_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
copy = ngx_array_push_n(conf->params, size);
if (copy == NULL) {
- return NGX_CONF_ERROR;
+ return NGX_ERROR;
}
copy->code = ngx_http_script_copy_code;
@@ -1501,12 +1546,12 @@ ngx_http_uwsgi_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
sc.values = &conf->params;
if (ngx_http_script_compile(&sc) != NGX_OK) {
- return NGX_CONF_ERROR;
+ return NGX_ERROR;
}
code = ngx_array_push_n(conf->params_len, sizeof(uintptr_t));
if (code == NULL) {
- return NGX_CONF_ERROR;
+ return NGX_ERROR;
}
*code = (uintptr_t) NULL;
@@ -1514,7 +1559,7 @@ ngx_http_uwsgi_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
code = ngx_array_push_n(conf->params, sizeof(uintptr_t));
if (code == NULL) {
- return NGX_CONF_ERROR;
+ return NGX_ERROR;
}
*code = (uintptr_t) NULL;
@@ -1522,7 +1567,7 @@ ngx_http_uwsgi_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
code = ngx_array_push_n(conf->params_len, sizeof(uintptr_t));
if (code == NULL) {
- return NGX_CONF_ERROR;
+ return NGX_ERROR;
}
*code = (uintptr_t) NULL;
@@ -1537,12 +1582,7 @@ ngx_http_uwsgi_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
hash.pool = cf->pool;
hash.temp_pool = NULL;
- if (ngx_hash_init(&hash, headers_names.elts, headers_names.nelts) != NGX_OK)
- {
- return NGX_CONF_ERROR;
- }
-
- return NGX_CONF_OK;
+ return ngx_hash_init(&hash, headers_names.elts, headers_names.nelts);
}
diff --git a/src/http/modules/perl/nginx.pm b/src/http/modules/perl/nginx.pm
index ca9551334..24071ed38 100644
--- a/src/http/modules/perl/nginx.pm
+++ b/src/http/modules/perl/nginx.pm
@@ -48,7 +48,7 @@ our @EXPORT = qw(
HTTP_INSUFFICIENT_STORAGE
);
-our $VERSION = '1.0.10';
+our $VERSION = '1.0.11';
require XSLoader;
XSLoader::load('nginx', $VERSION);
diff --git a/src/http/ngx_http_core_module.c b/src/http/ngx_http_core_module.c
index b94376236..c1fab3092 100644
--- a/src/http/ngx_http_core_module.c
+++ b/src/http/ngx_http_core_module.c
@@ -143,7 +143,7 @@ static ngx_conf_enum_t ngx_http_core_if_modified_since[] = {
};
-static ngx_conf_enum_t ngx_http_core_keepalive_disable[] = {
+static ngx_conf_bitmask_t ngx_http_core_keepalive_disable[] = {
{ ngx_string("none"), NGX_HTTP_KEEPALIVE_DISABLE_NONE },
{ ngx_string("msie6"), NGX_HTTP_KEEPALIVE_DISABLE_MSIE6 },
{ ngx_string("safari"), NGX_HTTP_KEEPALIVE_DISABLE_SAFARI },
@@ -513,8 +513,8 @@ static ngx_command_t ngx_http_core_commands[] = {
NULL },
{ ngx_string("keepalive_disable"),
- NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
- ngx_conf_set_enum_slot,
+ NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE12,
+ ngx_conf_set_bitmask_slot,
NGX_HTTP_LOC_CONF_OFFSET,
offsetof(ngx_http_core_loc_conf_t, keepalive_disable),
&ngx_http_core_keepalive_disable },
@@ -3264,12 +3264,12 @@ ngx_http_core_create_loc_conf(ngx_conf_t *cf)
* clcf->auto_redirect = 0;
* clcf->alias = 0;
* clcf->gzip_proxied = 0;
+ * clcf->keepalive_disable = 0;
*/
clcf->client_max_body_size = NGX_CONF_UNSET;
clcf->client_body_buffer_size = NGX_CONF_UNSET_SIZE;
clcf->client_body_timeout = NGX_CONF_UNSET_MSEC;
- clcf->keepalive_disable = NGX_CONF_UNSET_UINT;
clcf->satisfy = NGX_CONF_UNSET_UINT;
clcf->if_modified_since = NGX_CONF_UNSET_UINT;
clcf->max_ranges = NGX_CONF_UNSET_UINT;
@@ -3472,9 +3472,11 @@ ngx_http_core_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
ngx_conf_merge_msec_value(conf->client_body_timeout,
prev->client_body_timeout, 60000);
- ngx_conf_merge_uint_value(conf->keepalive_disable, prev->keepalive_disable,
- NGX_HTTP_KEEPALIVE_DISABLE_MSIE6
- |NGX_HTTP_KEEPALIVE_DISABLE_SAFARI);
+ ngx_conf_merge_bitmask_value(conf->keepalive_disable,
+ prev->keepalive_disable,
+ (NGX_CONF_BITMASK_SET
+ |NGX_HTTP_KEEPALIVE_DISABLE_MSIE6
+ |NGX_HTTP_KEEPALIVE_DISABLE_SAFARI));
ngx_conf_merge_uint_value(conf->satisfy, prev->satisfy,
NGX_HTTP_SATISFY_ALL);
ngx_conf_merge_uint_value(conf->if_modified_since, prev->if_modified_since,
@@ -4395,7 +4397,7 @@ ngx_http_core_open_file_cache(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
if (ngx_strncmp(value[i].data, "max=", 4) == 0) {
max = ngx_atoi(value[i].data + 4, value[i].len - 4);
- if (max == NGX_ERROR) {
+ if (max <= 0) {
goto failed;
}
diff --git a/src/http/ngx_http_request.c b/src/http/ngx_http_request.c
index c0d56ecaa..aea2228fd 100644
--- a/src/http/ngx_http_request.c
+++ b/src/http/ngx_http_request.c
@@ -671,25 +671,27 @@ ngx_http_ssl_servername(ngx_ssl_conn_t *ssl_conn, int *ad, void *arg)
sscf = ngx_http_get_module_srv_conf(r, ngx_http_ssl_module);
- SSL_set_SSL_CTX(ssl_conn, sscf->ssl.ctx);
+ if (sscf->ssl.ctx) {
+ SSL_set_SSL_CTX(ssl_conn, sscf->ssl.ctx);
- /*
- * SSL_set_SSL_CTX() only changes certs as of 1.0.0d
- * adjust other things we care about
- */
+ /*
+ * SSL_set_SSL_CTX() only changes certs as of 1.0.0d
+ * adjust other things we care about
+ */
- SSL_set_verify(ssl_conn, SSL_CTX_get_verify_mode(sscf->ssl.ctx),
- SSL_CTX_get_verify_callback(sscf->ssl.ctx));
+ SSL_set_verify(ssl_conn, SSL_CTX_get_verify_mode(sscf->ssl.ctx),
+ SSL_CTX_get_verify_callback(sscf->ssl.ctx));
- SSL_set_verify_depth(ssl_conn, SSL_CTX_get_verify_depth(sscf->ssl.ctx));
+ SSL_set_verify_depth(ssl_conn, SSL_CTX_get_verify_depth(sscf->ssl.ctx));
#ifdef SSL_CTRL_CLEAR_OPTIONS
- /* only in 0.9.8m+ */
- SSL_clear_options(ssl_conn, SSL_get_options(ssl_conn) &
- ~SSL_CTX_get_options(sscf->ssl.ctx));
+ /* only in 0.9.8m+ */
+ SSL_clear_options(ssl_conn, SSL_get_options(ssl_conn) &
+ ~SSL_CTX_get_options(sscf->ssl.ctx));
#endif
- SSL_set_options(ssl_conn, SSL_CTX_get_options(sscf->ssl.ctx));
+ SSL_set_options(ssl_conn, SSL_CTX_get_options(sscf->ssl.ctx));
+ }
return SSL_TLSEXT_ERR_OK;
}
diff --git a/src/http/ngx_http_upstream.c b/src/http/ngx_http_upstream.c
index 5aa96a425..99b252ebb 100644
--- a/src/http/ngx_http_upstream.c
+++ b/src/http/ngx_http_upstream.c
@@ -2888,6 +2888,7 @@ ngx_http_upstream_next(ngx_http_request_t *r, ngx_http_upstream_t *u,
#endif
ngx_close_connection(u->peer.connection);
+ u->peer.connection = NULL;
}
#if 0
@@ -4279,6 +4280,10 @@ ngx_http_upstream_add(ngx_conf_t *cf, ngx_url_t *u, ngx_uint_t flags)
continue;
}
+ if (flags & NGX_HTTP_UPSTREAM_CREATE) {
+ uscfp[i]->flags = flags;
+ }
+
return uscfp[i];
}
diff --git a/src/mail/ngx_mail_auth_http_module.c b/src/mail/ngx_mail_auth_http_module.c
index d54a392ac..c82332690 100644
--- a/src/mail/ngx_mail_auth_http_module.c
+++ b/src/mail/ngx_mail_auth_http_module.c
@@ -783,7 +783,7 @@ ngx_mail_auth_http_process_headers(ngx_mail_session_t *s,
sin->sin_family = AF_INET;
port = ngx_atoi(ctx->port.data, ctx->port.len);
- if (port == NGX_ERROR || port < 1 || port > 65536) {
+ if (port == NGX_ERROR || port < 1 || port > 65535) {
ngx_log_error(NGX_LOG_ERR, s->connection->log, 0,
"auth http server %V sent invalid server "
"port:\"%V\"",
diff --git a/src/mail/ngx_mail_proxy_module.c b/src/mail/ngx_mail_proxy_module.c
index a7c4b7e48..298e8d96a 100644
--- a/src/mail/ngx_mail_proxy_module.c
+++ b/src/mail/ngx_mail_proxy_module.c
@@ -60,7 +60,7 @@ static ngx_command_t ngx_mail_proxy_commands[] = {
NULL },
{ ngx_string("proxy_pass_error_message"),
- NGX_MAIL_MAIN_CONF|NGX_MAIL_SRV_CONF|NGX_CONF_TAKE1,
+ NGX_MAIL_MAIN_CONF|NGX_MAIL_SRV_CONF|NGX_CONF_FLAG,
ngx_conf_set_flag_slot,
NGX_MAIL_SRV_CONF_OFFSET,
offsetof(ngx_mail_proxy_conf_t, pass_error_message),
diff --git a/src/os/unix/ngx_darwin_init.c b/src/os/unix/ngx_darwin_init.c
index 67133198b..7d2913657 100644
--- a/src/os/unix/ngx_darwin_init.c
+++ b/src/os/unix/ngx_darwin_init.c
@@ -58,7 +58,6 @@ sysctl_t sysctls[] = {
ngx_int_t
ngx_os_specific_init(ngx_log_t *log)
{
- int somaxconn;
size_t size;
ngx_err_t err;
ngx_uint_t i;
@@ -125,12 +124,9 @@ ngx_os_specific_init(ngx_log_t *log)
ngx_ncpu = ngx_darwin_hw_ncpu;
- somaxconn = 32676;
-
- if (ngx_darwin_kern_ipc_somaxconn > somaxconn) {
+ if (ngx_darwin_kern_ipc_somaxconn > 32767) {
ngx_log_error(NGX_LOG_ALERT, log, 0,
- "sysctl kern.ipc.somaxconn must be no more than %d",
- somaxconn);
+ "sysctl kern.ipc.somaxconn must be less than 32768");
return NGX_ERROR;
}
diff --git a/src/os/unix/ngx_files.c b/src/os/unix/ngx_files.c
index 89ab8d6bc..196323727 100644
--- a/src/os/unix/ngx_files.c
+++ b/src/os/unix/ngx_files.c
@@ -153,7 +153,7 @@ ngx_write_chain_to_file(ngx_file_t *file, ngx_chain_t *cl, off_t offset,
{
u_char *prev;
size_t size;
- ssize_t n;
+ ssize_t total, n;
ngx_array_t vec;
struct iovec *iov, iovs[NGX_IOVS];
@@ -165,6 +165,8 @@ ngx_write_chain_to_file(ngx_file_t *file, ngx_chain_t *cl, off_t offset,
offset);
}
+ total = 0;
+
vec.elts = iovs;
vec.size = sizeof(struct iovec);
vec.nalloc = NGX_IOVS;
@@ -202,8 +204,15 @@ ngx_write_chain_to_file(ngx_file_t *file, ngx_chain_t *cl, off_t offset,
if (vec.nelts == 1) {
iov = vec.elts;
- return ngx_write_file(file, (u_char *) iov[0].iov_base,
- iov[0].iov_len, offset);
+
+ n = ngx_write_file(file, (u_char *) iov[0].iov_base,
+ iov[0].iov_len, offset);
+
+ if (n == NGX_ERROR) {
+ return n;
+ }
+
+ return total + n;
}
if (file->sys_offset != offset) {
@@ -233,10 +242,11 @@ ngx_write_chain_to_file(ngx_file_t *file, ngx_chain_t *cl, off_t offset,
file->sys_offset += n;
file->offset += n;
+ total += n;
} while (cl);
- return n;
+ return total;
}
@@ -454,7 +464,7 @@ ngx_unlock_fd(ngx_fd_t fd)
}
-#if (NGX_HAVE_POSIX_FADVISE)
+#if (NGX_HAVE_POSIX_FADVISE) && !(NGX_HAVE_F_READAHEAD)
ngx_int_t
ngx_read_ahead(ngx_fd_t fd, size_t n)
diff --git a/src/os/unix/ngx_files.h b/src/os/unix/ngx_files.h
index af41ea38e..7c7f1fcd3 100644
--- a/src/os/unix/ngx_files.h
+++ b/src/os/unix/ngx_files.h
@@ -128,6 +128,7 @@ ngx_write_fd(ngx_fd_t fd, void *buf, size_t n)
#define ngx_linefeed(p) *p++ = LF;
#define NGX_LINEFEED_SIZE 1
+#define NGX_LINEFEED "\x0a"
#define ngx_rename_file(o, n) rename((const char *) o, (const char *) n)
diff --git a/src/os/unix/ngx_freebsd_init.c b/src/os/unix/ngx_freebsd_init.c
index 1211c7ccb..2fa222dac 100644
--- a/src/os/unix/ngx_freebsd_init.c
+++ b/src/os/unix/ngx_freebsd_init.c
@@ -97,7 +97,7 @@ ngx_debug_init()
ngx_int_t
ngx_os_specific_init(ngx_log_t *log)
{
- int version, somaxconn;
+ int version;
size_t size;
ngx_err_t err;
ngx_uint_t i;
@@ -209,12 +209,9 @@ ngx_os_specific_init(ngx_log_t *log)
ngx_ncpu = ngx_freebsd_hw_ncpu;
}
- somaxconn = version < 600008 ? 32676 : 65535;
-
- if (ngx_freebsd_kern_ipc_somaxconn > somaxconn) {
+ if (version < 600008 && ngx_freebsd_kern_ipc_somaxconn > 32767) {
ngx_log_error(NGX_LOG_ALERT, log, 0,
- "sysctl kern.ipc.somaxconn must be no more than %d",
- somaxconn);
+ "sysctl kern.ipc.somaxconn must be less than 32768");
return NGX_ERROR;
}