summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--.hgtags1
-rw-r--r--CHANGES14
-rw-r--r--auto/make7
-rw-r--r--auto/modules/java2
-rw-r--r--auto/modules/perl2
-rw-r--r--auto/modules/php2
-rw-r--r--auto/modules/python2
-rw-r--r--auto/modules/ruby2
-rw-r--r--docs/changes.xml52
-rw-r--r--pkg/deb/Makefile2
-rw-r--r--pkg/deb/Makefile.go2
-rw-r--r--pkg/deb/Makefile.go1102
-rw-r--r--pkg/deb/Makefile.go1112
-rw-r--r--pkg/deb/Makefile.go172
-rw-r--r--pkg/deb/Makefile.go182
-rw-r--r--pkg/deb/Makefile.go192
-rw-r--r--pkg/deb/Makefile.jsc-common2
-rw-r--r--pkg/deb/Makefile.jsc102
-rw-r--r--pkg/deb/Makefile.jsc112
-rw-r--r--pkg/deb/Makefile.jsc82
-rw-r--r--pkg/deb/Makefile.perl2
-rw-r--r--pkg/deb/Makefile.php2
-rw-r--r--pkg/deb/Makefile.python2
-rw-r--r--pkg/deb/Makefile.python272
-rw-r--r--pkg/deb/Makefile.python342
-rw-r--r--pkg/deb/Makefile.python352
-rw-r--r--pkg/deb/Makefile.python362
-rw-r--r--pkg/deb/Makefile.python372
-rw-r--r--pkg/deb/Makefile.ruby2
-rw-r--r--pkg/deb/debian/unit.init4
-rw-r--r--pkg/deb/debian/unit.logrotate15
-rw-r--r--pkg/docker/Dockerfile.full6
-rw-r--r--pkg/docker/Dockerfile.go1.7-dev6
-rw-r--r--pkg/docker/Dockerfile.go1.8-dev6
-rw-r--r--pkg/docker/Dockerfile.minimal6
-rw-r--r--pkg/docker/Dockerfile.perl5.246
-rw-r--r--pkg/docker/Dockerfile.php7.06
-rw-r--r--pkg/docker/Dockerfile.python2.76
-rw-r--r--pkg/docker/Dockerfile.python3.56
-rw-r--r--pkg/docker/Dockerfile.ruby2.36
-rw-r--r--pkg/docker/Dockerfile.tmpl4
-rw-r--r--pkg/docker/Makefile2
-rwxr-xr-xpkg/docker/docker-entrypoint.sh71
-rw-r--r--pkg/rpm/Makefile2
-rw-r--r--pkg/rpm/Makefile.go2
-rw-r--r--pkg/rpm/Makefile.jsc-common2
-rw-r--r--pkg/rpm/Makefile.jsc112
-rw-r--r--pkg/rpm/Makefile.jsc82
-rw-r--r--pkg/rpm/Makefile.perl2
-rw-r--r--pkg/rpm/Makefile.php2
-rw-r--r--pkg/rpm/Makefile.python2
-rw-r--r--pkg/rpm/Makefile.python272
-rw-r--r--pkg/rpm/Makefile.python342
-rw-r--r--pkg/rpm/Makefile.python352
-rw-r--r--pkg/rpm/Makefile.python362
-rw-r--r--pkg/rpm/Makefile.python372
-rw-r--r--pkg/rpm/Makefile.ruby2
-rw-r--r--pkg/rpm/rpmbuild/SOURCES/unit.logrotate4
-rw-r--r--src/go/unit/response.go2
-rw-r--r--src/nxt_clone.c4
-rw-r--r--src/nxt_errno.h1
-rw-r--r--src/nxt_h1proto.c2
-rw-r--r--src/nxt_http_error.c18
-rw-r--r--src/nxt_http_parse.c59
-rw-r--r--src/nxt_http_parse.h1
-rw-r--r--src/nxt_http_static.c14
-rw-r--r--src/nxt_kqueue_engine.c5
-rw-r--r--src/nxt_main_process.c91
-rw-r--r--src/nxt_openssl.c16
-rw-r--r--src/nxt_php_sapi.c4
-rw-r--r--src/nxt_process.c57
-rw-r--r--src/test/nxt_http_parse_test.c22
-rw-r--r--test/test_static.py24
-rw-r--r--test/unit/applications/lang/go.py30
-rw-r--r--test/unit/applications/lang/java.py8
-rw-r--r--version4
76 files changed, 445 insertions, 223 deletions
diff --git a/.hgtags b/.hgtags
index 1611c84c..e8b6cc13 100644
--- a/.hgtags
+++ b/.hgtags
@@ -29,3 +29,4 @@ b651ff72ffe080835f884a1ace8fa24eb33e3569 1.10.0-2
3b1601ac0f2f53fed4cae01b9db0e4e070665cae 1.11.0
7d54dfd170985c2ae8281219cfe7aa19de6d0de0 1.11.0-1
c27c08b0deeee58676f3880f0f315388ce5d9322 1.11.0-2
+b391df5f0102aa6afe660cfc863729c1b1111c9e 1.12.0
diff --git a/CHANGES b/CHANGES
index 76f07a38..608f3ee7 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,4 +1,18 @@
+Changes with Unit 1.12.0 03 Oct 2019
+
+ *) Feature: compatibility with PHP 7.4.
+
+ *) Bugfix: descriptors leak on process creation; the bug had appeared in
+ 1.11.0.
+
+ *) Bugfix: TLS connection might be closed prematurely while sending
+ response.
+
+ *) Bugfix: segmentation fault might have occurred if an irregular file
+ was requested.
+
+
Changes with Unit 1.11.0 19 Sep 2019
*) Feature: basic support for serving static files.
diff --git a/auto/make b/auto/make
index a5899c53..4b1e76fc 100644
--- a/auto/make
+++ b/auto/make
@@ -78,9 +78,6 @@ $NXT_VERSION_H: version
$echo '#define NXT_VERSION "\$(NXT_VERSION)"' > $NXT_VERSION_H
$echo '#define NXT_VERNUM \$(NXT_VERNUM)' >> $NXT_VERSION_H
-$NXT_BUILD_DIR/src/nxt_unit.o: $NXT_VERSION_H
-$NXT_BUILD_DIR/src/nxt_lib.o: $NXT_VERSION_H
-
END
@@ -119,7 +116,7 @@ do
nxt_dep_post=`nxt_gen_dep_post`
cat << END >> $NXT_MAKEFILE
-$NXT_BUILD_DIR/$nxt_obj: $nxt_src
+$NXT_BUILD_DIR/$nxt_obj: $nxt_src $NXT_VERSION_H
\$(CC) -c \$(CFLAGS) \$(NXT_LIB_INCS) $NXT_LIB_AUX_CFLAGS \\
-o $NXT_BUILD_DIR/$nxt_obj \\
$nxt_dep_flags \\
@@ -265,7 +262,7 @@ do
nxt_dep_post=`nxt_gen_dep_post`
cat << END >> $NXT_MAKEFILE
-$NXT_BUILD_DIR/$nxt_obj: $nxt_src
+$NXT_BUILD_DIR/$nxt_obj: $nxt_src $NXT_VERSION_H
\$(CC) -c \$(CFLAGS) \$(NXT_INCS) \\
$NXT_LIB_AUX_CFLAGS \\
-o $NXT_BUILD_DIR/$nxt_obj \\
diff --git a/auto/modules/java b/auto/modules/java
index 24ee4927..b0fd62f1 100644
--- a/auto/modules/java
+++ b/auto/modules/java
@@ -336,7 +336,7 @@ for nxt_src in $NXT_JAVA_MODULE_SRCS; do
cat << END >> $NXT_MAKEFILE
-$NXT_BUILD_DIR/$nxt_obj: $nxt_src
+$NXT_BUILD_DIR/$nxt_obj: $nxt_src $NXT_VERSION_H
mkdir -p $NXT_BUILD_DIR/src/java
\$(CC) -c \$(CFLAGS) \$(NXT_INCS) $NXT_JAVA_INCLUDE \\
$nxt_dep_flags \\
diff --git a/auto/modules/perl b/auto/modules/perl
index a4fd5437..e9d7e109 100644
--- a/auto/modules/perl
+++ b/auto/modules/perl
@@ -164,7 +164,7 @@ for nxt_src in $NXT_PERL_MODULE_SRCS; do
cat << END >> $NXT_MAKEFILE
-$NXT_BUILD_DIR/$nxt_obj: $nxt_src
+$NXT_BUILD_DIR/$nxt_obj: $nxt_src $NXT_VERSION_H
mkdir -p $NXT_BUILD_DIR/src/perl
\$(CC) -c \$(CFLAGS) $NXT_PERL_CFLAGS \$(NXT_INCS) $NXT_PERL_INCLUDE \\
$nxt_dep_flags \\
diff --git a/auto/modules/php b/auto/modules/php
index 362bbc69..97d1ac43 100644
--- a/auto/modules/php
+++ b/auto/modules/php
@@ -203,7 +203,7 @@ for nxt_src in $NXT_PHP_MODULE_SRCS; do
cat << END >> $NXT_MAKEFILE
-$NXT_BUILD_DIR/$nxt_obj: $nxt_src
+$NXT_BUILD_DIR/$nxt_obj: $nxt_src $NXT_VERSION_H
\$(CC) -c \$(CFLAGS) \$(NXT_INCS) $NXT_PHP_INCLUDE \\
-DNXT_ZEND_SIGNAL_STARTUP=$NXT_ZEND_SIGNAL_STARTUP \\
$nxt_dep_flags \\
diff --git a/auto/modules/python b/auto/modules/python
index e298f5b9..abd145c9 100644
--- a/auto/modules/python
+++ b/auto/modules/python
@@ -149,7 +149,7 @@ for nxt_src in $NXT_PYTHON_MODULE_SRCS; do
cat << END >> $NXT_MAKEFILE
-$NXT_BUILD_DIR/$nxt_obj: $nxt_src
+$NXT_BUILD_DIR/$nxt_obj: $nxt_src $NXT_VERSION_H
\$(CC) -c \$(CFLAGS) \$(NXT_INCS) $NXT_PYTHON_INCLUDE \\
$nxt_dep_flags \\
-o $NXT_BUILD_DIR/$nxt_obj $nxt_src
diff --git a/auto/modules/ruby b/auto/modules/ruby
index 7d379f2f..407406ce 100644
--- a/auto/modules/ruby
+++ b/auto/modules/ruby
@@ -160,7 +160,7 @@ for nxt_src in $NXT_RUBY_MODULE_SRCS; do
cat << END >> $NXT_MAKEFILE
-$NXT_BUILD_DIR/$nxt_obj: $nxt_src
+$NXT_BUILD_DIR/$nxt_obj: $nxt_src $NXT_VERSION_H
mkdir -p $NXT_BUILD_DIR/src/ruby
\$(CC) -c \$(CFLAGS) \$(NXT_INCS) $NXT_RUBY_INCPATH \\
$nxt_dep_flags \\
diff --git a/docs/changes.xml b/docs/changes.xml
index 192c366e..e0dc0b3f 100644
--- a/docs/changes.xml
+++ b/docs/changes.xml
@@ -33,6 +33,58 @@ Bump packaging version to fix repositories inconsistencies.
unit-perl
unit-ruby
unit-jsc-common unit-jsc8 unit-jsc10 unit-jsc11"
+ ver="1.12.0" rev="1"
+ date="2019-10-03" time="18:00:00 +0300"
+ packager="Andrei Belov &lt;defan@nginx.com&gt;">
+
+<change>
+<para>
+NGINX Unit updated to 1.12.0.
+</para>
+</change>
+
+</changes>
+
+
+<changes apply="unit" ver="1.12.0" rev="1"
+ date="2019-10-03" time="18:00:00 +0300"
+ packager="Andrei Belov &lt;defan@nginx.com&gt;">
+
+<change type="feature">
+<para>
+compatibility with PHP 7.4.
+</para>
+</change>
+
+<change type="bugfix">
+<para>
+descriptors leak on process creation; the bug had appeared in 1.11.0.
+</para>
+</change>
+
+<change type="bugfix">
+<para>
+TLS connection might be closed prematurely while sending response.
+</para>
+</change>
+
+<change type="bugfix">
+<para>
+segmentation fault might have occurred if an irregular file was requested.
+</para>
+</change>
+
+</changes>
+
+
+
+<changes apply="unit-php
+ unit-python unit-python2.7
+ unit-python3.4 unit-python3.5 unit-python3.6 unit-python3.7
+ unit-go unit-go1.7 unit-go1.8 unit-go1.9 unit-go1.10 unit-go1.11
+ unit-perl
+ unit-ruby
+ unit-jsc-common unit-jsc8 unit-jsc10 unit-jsc11"
ver="1.11.0" rev="1"
date="2019-09-19" time="18:00:00 +0300"
packager="Konstantin Pavlov &lt;thresh@nginx.com&gt;">
diff --git a/pkg/deb/Makefile b/pkg/deb/Makefile
index ac7cc679..952408cd 100644
--- a/pkg/deb/Makefile
+++ b/pkg/deb/Makefile
@@ -2,7 +2,7 @@
include ../../version
-DEFAULT_RELEASE := 2
+DEFAULT_RELEASE := 1
VERSION ?= $(NXT_VERSION)
RELEASE ?= $(DEFAULT_RELEASE)
diff --git a/pkg/deb/Makefile.go b/pkg/deb/Makefile.go
index 549a2b3b..3399f5ca 100644
--- a/pkg/deb/Makefile.go
+++ b/pkg/deb/Makefile.go
@@ -4,7 +4,7 @@ MODULE_SUFFIX_go= go
MODULE_SUMMARY_go= Go module for NGINX Unit
MODULE_VERSION_go= $(VERSION)
-MODULE_RELEASE_go= 2
+MODULE_RELEASE_go= 1
MODULE_CONFARGS_go= go --go-path=/usr/share/gocode
MODULE_MAKEARGS_go= go
diff --git a/pkg/deb/Makefile.go110 b/pkg/deb/Makefile.go110
index b678e278..0e956d9f 100644
--- a/pkg/deb/Makefile.go110
+++ b/pkg/deb/Makefile.go110
@@ -4,7 +4,7 @@ MODULE_SUFFIX_go110= go1.10
MODULE_SUMMARY_go110= Go 1.10 module for NGINX Unit
MODULE_VERSION_go110= $(VERSION)
-MODULE_RELEASE_go110= 2
+MODULE_RELEASE_go110= 1
MODULE_CONFARGS_go110= go --go=/usr/lib/go-1.10/bin/go --go-path=/usr/share/gocode
MODULE_MAKEARGS_go110= /usr/lib/go-1.10/bin/go
diff --git a/pkg/deb/Makefile.go111 b/pkg/deb/Makefile.go111
index 4af99ac1..f8ed5ae8 100644
--- a/pkg/deb/Makefile.go111
+++ b/pkg/deb/Makefile.go111
@@ -4,7 +4,7 @@ MODULE_SUFFIX_go111= go1.11
MODULE_SUMMARY_go111= Go 1.11 module for NGINX Unit
MODULE_VERSION_go111= $(VERSION)
-MODULE_RELEASE_go111= 2
+MODULE_RELEASE_go111= 1
MODULE_CONFARGS_go111= go --go=/usr/lib/go-1.11/bin/go --go-path=/usr/share/gocode
MODULE_MAKEARGS_go111= /usr/lib/go-1.11/bin/go
diff --git a/pkg/deb/Makefile.go17 b/pkg/deb/Makefile.go17
index a2032ce9..d014edd1 100644
--- a/pkg/deb/Makefile.go17
+++ b/pkg/deb/Makefile.go17
@@ -4,7 +4,7 @@ MODULE_SUFFIX_go17= go1.7
MODULE_SUMMARY_go17= Go 1.7 module for NGINX Unit
MODULE_VERSION_go17= $(VERSION)
-MODULE_RELEASE_go17= 2
+MODULE_RELEASE_go17= 1
MODULE_CONFARGS_go17= go --go=/usr/lib/go-1.7/bin/go --go-path=/usr/share/gocode
MODULE_MAKEARGS_go17= /usr/lib/go-1.7/bin/go
diff --git a/pkg/deb/Makefile.go18 b/pkg/deb/Makefile.go18
index 601f18c9..597f4804 100644
--- a/pkg/deb/Makefile.go18
+++ b/pkg/deb/Makefile.go18
@@ -4,7 +4,7 @@ MODULE_SUFFIX_go18= go1.8
MODULE_SUMMARY_go18= Go 1.8 module for NGINX Unit
MODULE_VERSION_go18= $(VERSION)
-MODULE_RELEASE_go18= 2
+MODULE_RELEASE_go18= 1
MODULE_CONFARGS_go18= go --go=/usr/lib/go-1.8/bin/go --go-path=/usr/share/gocode
MODULE_MAKEARGS_go18= /usr/lib/go-1.8/bin/go
diff --git a/pkg/deb/Makefile.go19 b/pkg/deb/Makefile.go19
index 7ca8ea1a..60d4b239 100644
--- a/pkg/deb/Makefile.go19
+++ b/pkg/deb/Makefile.go19
@@ -4,7 +4,7 @@ MODULE_SUFFIX_go19= go1.9
MODULE_SUMMARY_go19= Go 1.9 module for NGINX Unit
MODULE_VERSION_go19= $(VERSION)
-MODULE_RELEASE_go19= 2
+MODULE_RELEASE_go19= 1
MODULE_CONFARGS_go19= go --go=/usr/lib/go-1.9/bin/go --go-path=/usr/share/gocode
MODULE_MAKEARGS_go19= /usr/lib/go-1.9/bin/go
diff --git a/pkg/deb/Makefile.jsc-common b/pkg/deb/Makefile.jsc-common
index 3f34aece..30f777fd 100644
--- a/pkg/deb/Makefile.jsc-common
+++ b/pkg/deb/Makefile.jsc-common
@@ -4,7 +4,7 @@ MODULE_SUFFIX_jsc_common= jsc-common
MODULE_SUMMARY_jsc_common= Java shared packages for NGINX Unit
MODULE_VERSION_jsc_common= $(VERSION)
-MODULE_RELEASE_jsc_common= 2
+MODULE_RELEASE_jsc_common= 1
ifneq (,$(findstring $(CODENAME),disco buster))
JAVA_MINVERSION= 11
diff --git a/pkg/deb/Makefile.jsc10 b/pkg/deb/Makefile.jsc10
index df59abb8..43ded86b 100644
--- a/pkg/deb/Makefile.jsc10
+++ b/pkg/deb/Makefile.jsc10
@@ -4,7 +4,7 @@ MODULE_SUFFIX_jsc10= jsc10
MODULE_SUMMARY_jsc10= Java 10 module for NGINX Unit
MODULE_VERSION_jsc10= $(VERSION)
-MODULE_RELEASE_jsc10= 2
+MODULE_RELEASE_jsc10= 1
MODULE_CONFARGS_jsc10= java --module=java10 --home=/usr/lib/jvm/java-11-openjdk-$$\(DEB_HOST_ARCH\) --jars=/usr/share/unit-jsc-common/
MODULE_MAKEARGS_jsc10= java10
diff --git a/pkg/deb/Makefile.jsc11 b/pkg/deb/Makefile.jsc11
index fcf17bc9..40f60f17 100644
--- a/pkg/deb/Makefile.jsc11
+++ b/pkg/deb/Makefile.jsc11
@@ -4,7 +4,7 @@ MODULE_SUFFIX_jsc11= jsc11
MODULE_SUMMARY_jsc11= Java 11 module for NGINX Unit
MODULE_VERSION_jsc11= $(VERSION)
-MODULE_RELEASE_jsc11= 2
+MODULE_RELEASE_jsc11= 1
MODULE_CONFARGS_jsc11= java --module=java11 --home=/usr/lib/jvm/java-11-openjdk-$$\(DEB_HOST_ARCH\) --jars=/usr/share/unit-jsc-common/
MODULE_MAKEARGS_jsc11= java11
diff --git a/pkg/deb/Makefile.jsc8 b/pkg/deb/Makefile.jsc8
index a98a4a3a..d7eed96b 100644
--- a/pkg/deb/Makefile.jsc8
+++ b/pkg/deb/Makefile.jsc8
@@ -4,7 +4,7 @@ MODULE_SUFFIX_jsc8= jsc8
MODULE_SUMMARY_jsc8= Java 8 module for NGINX Unit
MODULE_VERSION_jsc8= $(VERSION)
-MODULE_RELEASE_jsc8= 2
+MODULE_RELEASE_jsc8= 1
MODULE_CONFARGS_jsc8= java --module=java8 --home=/usr/lib/jvm/java-8-openjdk-$$\(DEB_HOST_ARCH\) --jars=/usr/share/unit-jsc-common/
MODULE_MAKEARGS_jsc8= java8
diff --git a/pkg/deb/Makefile.perl b/pkg/deb/Makefile.perl
index 8f47a7d3..7ac3ea11 100644
--- a/pkg/deb/Makefile.perl
+++ b/pkg/deb/Makefile.perl
@@ -4,7 +4,7 @@ MODULE_SUFFIX_perl= perl
MODULE_SUMMARY_perl= Perl module for NGINX Unit
MODULE_VERSION_perl= $(VERSION)
-MODULE_RELEASE_perl= 2
+MODULE_RELEASE_perl= 1
MODULE_CONFARGS_perl= perl
MODULE_MAKEARGS_perl= perl
diff --git a/pkg/deb/Makefile.php b/pkg/deb/Makefile.php
index d46a09c9..d05d5ad5 100644
--- a/pkg/deb/Makefile.php
+++ b/pkg/deb/Makefile.php
@@ -4,7 +4,7 @@ MODULE_SUFFIX_php= php
MODULE_SUMMARY_php= PHP module for NGINX Unit
MODULE_VERSION_php= $(VERSION)
-MODULE_RELEASE_php= 2
+MODULE_RELEASE_php= 1
MODULE_CONFARGS_php= php
MODULE_MAKEARGS_php= php
diff --git a/pkg/deb/Makefile.python b/pkg/deb/Makefile.python
index 84d2bb64..9bf02bac 100644
--- a/pkg/deb/Makefile.python
+++ b/pkg/deb/Makefile.python
@@ -4,7 +4,7 @@ MODULE_SUFFIX_python= python
MODULE_SUMMARY_python= Python module for NGINX Unit
MODULE_VERSION_python= $(VERSION)
-MODULE_RELEASE_python= 2
+MODULE_RELEASE_python= 1
MODULE_CONFARGS_python= python
MODULE_MAKEARGS_python= python
diff --git a/pkg/deb/Makefile.python27 b/pkg/deb/Makefile.python27
index 7779b7b3..cf4f49d9 100644
--- a/pkg/deb/Makefile.python27
+++ b/pkg/deb/Makefile.python27
@@ -4,7 +4,7 @@ MODULE_SUFFIX_python27= python2.7
MODULE_SUMMARY_python27= Python 2.7 module for NGINX Unit
MODULE_VERSION_python27= $(VERSION)
-MODULE_RELEASE_python27= 2
+MODULE_RELEASE_python27= 1
MODULE_CONFARGS_python27= python --config=python2.7-config
MODULE_MAKEARGS_python27= python2.7
diff --git a/pkg/deb/Makefile.python34 b/pkg/deb/Makefile.python34
index 71ab873d..03c496bd 100644
--- a/pkg/deb/Makefile.python34
+++ b/pkg/deb/Makefile.python34
@@ -4,7 +4,7 @@ MODULE_SUFFIX_python34= python3.4
MODULE_SUMMARY_python34= Python 3.4 module for NGINX Unit
MODULE_VERSION_python34= $(VERSION)
-MODULE_RELEASE_python34= 2
+MODULE_RELEASE_python34= 1
MODULE_CONFARGS_python34= python --config=python3.4-config
MODULE_MAKEARGS_python34= python3.4
diff --git a/pkg/deb/Makefile.python35 b/pkg/deb/Makefile.python35
index 9f0b705c..514a4bf6 100644
--- a/pkg/deb/Makefile.python35
+++ b/pkg/deb/Makefile.python35
@@ -4,7 +4,7 @@ MODULE_SUFFIX_python35= python3.5
MODULE_SUMMARY_python35= Python 3.5 module for NGINX Unit
MODULE_VERSION_python35= $(VERSION)
-MODULE_RELEASE_python35= 2
+MODULE_RELEASE_python35= 1
MODULE_CONFARGS_python35= python --config=python3.5-config
MODULE_MAKEARGS_python35= python3.5
diff --git a/pkg/deb/Makefile.python36 b/pkg/deb/Makefile.python36
index 93f12bd8..4fd898c6 100644
--- a/pkg/deb/Makefile.python36
+++ b/pkg/deb/Makefile.python36
@@ -4,7 +4,7 @@ MODULE_SUFFIX_python36= python3.6
MODULE_SUMMARY_python36= Python 3.6 module for NGINX Unit
MODULE_VERSION_python36= $(VERSION)
-MODULE_RELEASE_python36= 2
+MODULE_RELEASE_python36= 1
MODULE_CONFARGS_python36= python --config=python3.6-config
MODULE_MAKEARGS_python36= python3.6
diff --git a/pkg/deb/Makefile.python37 b/pkg/deb/Makefile.python37
index 652986f3..54dd8c4c 100644
--- a/pkg/deb/Makefile.python37
+++ b/pkg/deb/Makefile.python37
@@ -4,7 +4,7 @@ MODULE_SUFFIX_python37= python3.7
MODULE_SUMMARY_python37= Python 3.7 module for NGINX Unit
MODULE_VERSION_python37= $(VERSION)
-MODULE_RELEASE_python37= 2
+MODULE_RELEASE_python37= 1
MODULE_CONFARGS_python37= python --config=python3.7-config
MODULE_MAKEARGS_python37= python3.7
diff --git a/pkg/deb/Makefile.ruby b/pkg/deb/Makefile.ruby
index 039f1ce4..dd85cd38 100644
--- a/pkg/deb/Makefile.ruby
+++ b/pkg/deb/Makefile.ruby
@@ -4,7 +4,7 @@ MODULE_SUFFIX_ruby= ruby
MODULE_SUMMARY_ruby= Ruby module for NGINX Unit
MODULE_VERSION_ruby= $(VERSION)
-MODULE_RELEASE_ruby= 2
+MODULE_RELEASE_ruby= 1
MODULE_CONFARGS_ruby= ruby
MODULE_MAKEARGS_ruby= ruby
diff --git a/pkg/deb/debian/unit.init b/pkg/deb/debian/unit.init
index 2f573f99..900e97fd 100644
--- a/pkg/deb/debian/unit.init
+++ b/pkg/deb/debian/unit.init
@@ -13,11 +13,9 @@
### END INIT INFO
PATH=/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/sbin/unitd
-NAME=unitd
+NAME=unit
DESC=unitd
-[ -r /etc/default/${NAME} ] && . /etc/default/${NAME}
-
#includes lsb functions
. /lib/lsb/init-functions
diff --git a/pkg/deb/debian/unit.logrotate b/pkg/deb/debian/unit.logrotate
new file mode 100644
index 00000000..416947ca
--- /dev/null
+++ b/pkg/deb/debian/unit.logrotate
@@ -0,0 +1,15 @@
+/var/log/unit.log {
+ daily
+ missingok
+ rotate 7
+ compress
+ delaycompress
+ nocreate
+ notifempty
+ su root root
+ postrotate
+ if [ -f /var/run/unit.pid ]; then
+ /bin/kill -SIGUSR1 `cat /var/run/unit.pid`
+ fi
+ endscript
+}
diff --git a/pkg/docker/Dockerfile.full b/pkg/docker/Dockerfile.full
index ae700b32..c6646fda 100644
--- a/pkg/docker/Dockerfile.full
+++ b/pkg/docker/Dockerfile.full
@@ -2,7 +2,7 @@ FROM debian:stretch-slim
LABEL maintainer="NGINX Docker Maintainers <docker-maint@nginx.com>"
-ENV UNIT_VERSION 1.11.0-2~stretch
+ENV UNIT_VERSION 1.12.0-1~stretch
RUN set -x \
&& apt-get update \
@@ -86,4 +86,8 @@ RUN ln -sf /dev/stdout /var/log/unit.log
STOPSIGNAL SIGTERM
+COPY docker-entrypoint.sh /usr/local/bin/
+RUN mkdir /docker-entrypoint.d/
+ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
+
CMD ["unitd", "--no-daemon", "--control", "unix:/var/run/control.unit.sock"]
diff --git a/pkg/docker/Dockerfile.go1.7-dev b/pkg/docker/Dockerfile.go1.7-dev
index 12b80daa..9b57d3ec 100644
--- a/pkg/docker/Dockerfile.go1.7-dev
+++ b/pkg/docker/Dockerfile.go1.7-dev
@@ -2,7 +2,7 @@ FROM debian:stretch-slim
LABEL maintainer="NGINX Docker Maintainers <docker-maint@nginx.com>"
-ENV UNIT_VERSION 1.11.0-2~stretch
+ENV UNIT_VERSION 1.12.0-1~stretch
RUN set -x \
&& apt-get update \
@@ -86,4 +86,8 @@ RUN ln -sf /dev/stdout /var/log/unit.log
STOPSIGNAL SIGTERM
+COPY docker-entrypoint.sh /usr/local/bin/
+RUN mkdir /docker-entrypoint.d/
+ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
+
CMD ["unitd", "--no-daemon", "--control", "unix:/var/run/control.unit.sock"]
diff --git a/pkg/docker/Dockerfile.go1.8-dev b/pkg/docker/Dockerfile.go1.8-dev
index 58b36458..5f650aae 100644
--- a/pkg/docker/Dockerfile.go1.8-dev
+++ b/pkg/docker/Dockerfile.go1.8-dev
@@ -2,7 +2,7 @@ FROM debian:stretch-slim
LABEL maintainer="NGINX Docker Maintainers <docker-maint@nginx.com>"
-ENV UNIT_VERSION 1.11.0-2~stretch
+ENV UNIT_VERSION 1.12.0-1~stretch
RUN set -x \
&& apt-get update \
@@ -86,4 +86,8 @@ RUN ln -sf /dev/stdout /var/log/unit.log
STOPSIGNAL SIGTERM
+COPY docker-entrypoint.sh /usr/local/bin/
+RUN mkdir /docker-entrypoint.d/
+ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
+
CMD ["unitd", "--no-daemon", "--control", "unix:/var/run/control.unit.sock"]
diff --git a/pkg/docker/Dockerfile.minimal b/pkg/docker/Dockerfile.minimal
index 587ef3f1..427a3ada 100644
--- a/pkg/docker/Dockerfile.minimal
+++ b/pkg/docker/Dockerfile.minimal
@@ -2,7 +2,7 @@ FROM debian:stretch-slim
LABEL maintainer="NGINX Docker Maintainers <docker-maint@nginx.com>"
-ENV UNIT_VERSION 1.11.0-2~stretch
+ENV UNIT_VERSION 1.12.0-1~stretch
RUN set -x \
&& apt-get update \
@@ -86,4 +86,8 @@ RUN ln -sf /dev/stdout /var/log/unit.log
STOPSIGNAL SIGTERM
+COPY docker-entrypoint.sh /usr/local/bin/
+RUN mkdir /docker-entrypoint.d/
+ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
+
CMD ["unitd", "--no-daemon", "--control", "unix:/var/run/control.unit.sock"]
diff --git a/pkg/docker/Dockerfile.perl5.24 b/pkg/docker/Dockerfile.perl5.24
index fb77a03a..7e51adcf 100644
--- a/pkg/docker/Dockerfile.perl5.24
+++ b/pkg/docker/Dockerfile.perl5.24
@@ -2,7 +2,7 @@ FROM debian:stretch-slim
LABEL maintainer="NGINX Docker Maintainers <docker-maint@nginx.com>"
-ENV UNIT_VERSION 1.11.0-2~stretch
+ENV UNIT_VERSION 1.12.0-1~stretch
RUN set -x \
&& apt-get update \
@@ -86,4 +86,8 @@ RUN ln -sf /dev/stdout /var/log/unit.log
STOPSIGNAL SIGTERM
+COPY docker-entrypoint.sh /usr/local/bin/
+RUN mkdir /docker-entrypoint.d/
+ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
+
CMD ["unitd", "--no-daemon", "--control", "unix:/var/run/control.unit.sock"]
diff --git a/pkg/docker/Dockerfile.php7.0 b/pkg/docker/Dockerfile.php7.0
index 2654fe04..9615e041 100644
--- a/pkg/docker/Dockerfile.php7.0
+++ b/pkg/docker/Dockerfile.php7.0
@@ -2,7 +2,7 @@ FROM debian:stretch-slim
LABEL maintainer="NGINX Docker Maintainers <docker-maint@nginx.com>"
-ENV UNIT_VERSION 1.11.0-2~stretch
+ENV UNIT_VERSION 1.12.0-1~stretch
RUN set -x \
&& apt-get update \
@@ -86,4 +86,8 @@ RUN ln -sf /dev/stdout /var/log/unit.log
STOPSIGNAL SIGTERM
+COPY docker-entrypoint.sh /usr/local/bin/
+RUN mkdir /docker-entrypoint.d/
+ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
+
CMD ["unitd", "--no-daemon", "--control", "unix:/var/run/control.unit.sock"]
diff --git a/pkg/docker/Dockerfile.python2.7 b/pkg/docker/Dockerfile.python2.7
index 61a3e655..eb599f95 100644
--- a/pkg/docker/Dockerfile.python2.7
+++ b/pkg/docker/Dockerfile.python2.7
@@ -2,7 +2,7 @@ FROM debian:stretch-slim
LABEL maintainer="NGINX Docker Maintainers <docker-maint@nginx.com>"
-ENV UNIT_VERSION 1.11.0-2~stretch
+ENV UNIT_VERSION 1.12.0-1~stretch
RUN set -x \
&& apt-get update \
@@ -86,4 +86,8 @@ RUN ln -sf /dev/stdout /var/log/unit.log
STOPSIGNAL SIGTERM
+COPY docker-entrypoint.sh /usr/local/bin/
+RUN mkdir /docker-entrypoint.d/
+ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
+
CMD ["unitd", "--no-daemon", "--control", "unix:/var/run/control.unit.sock"]
diff --git a/pkg/docker/Dockerfile.python3.5 b/pkg/docker/Dockerfile.python3.5
index 85c0ccb9..362fb3ed 100644
--- a/pkg/docker/Dockerfile.python3.5
+++ b/pkg/docker/Dockerfile.python3.5
@@ -2,7 +2,7 @@ FROM debian:stretch-slim
LABEL maintainer="NGINX Docker Maintainers <docker-maint@nginx.com>"
-ENV UNIT_VERSION 1.11.0-2~stretch
+ENV UNIT_VERSION 1.12.0-1~stretch
RUN set -x \
&& apt-get update \
@@ -86,4 +86,8 @@ RUN ln -sf /dev/stdout /var/log/unit.log
STOPSIGNAL SIGTERM
+COPY docker-entrypoint.sh /usr/local/bin/
+RUN mkdir /docker-entrypoint.d/
+ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
+
CMD ["unitd", "--no-daemon", "--control", "unix:/var/run/control.unit.sock"]
diff --git a/pkg/docker/Dockerfile.ruby2.3 b/pkg/docker/Dockerfile.ruby2.3
index 253e9ed0..cc2e8637 100644
--- a/pkg/docker/Dockerfile.ruby2.3
+++ b/pkg/docker/Dockerfile.ruby2.3
@@ -2,7 +2,7 @@ FROM debian:stretch-slim
LABEL maintainer="NGINX Docker Maintainers <docker-maint@nginx.com>"
-ENV UNIT_VERSION 1.11.0-2~stretch
+ENV UNIT_VERSION 1.12.0-1~stretch
RUN set -x \
&& apt-get update \
@@ -86,4 +86,8 @@ RUN ln -sf /dev/stdout /var/log/unit.log
STOPSIGNAL SIGTERM
+COPY docker-entrypoint.sh /usr/local/bin/
+RUN mkdir /docker-entrypoint.d/
+ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
+
CMD ["unitd", "--no-daemon", "--control", "unix:/var/run/control.unit.sock"]
diff --git a/pkg/docker/Dockerfile.tmpl b/pkg/docker/Dockerfile.tmpl
index 18d6d34e..c721931b 100644
--- a/pkg/docker/Dockerfile.tmpl
+++ b/pkg/docker/Dockerfile.tmpl
@@ -86,4 +86,8 @@ RUN ln -sf /dev/stdout /var/log/unit.log
STOPSIGNAL SIGTERM
+COPY docker-entrypoint.sh /usr/local/bin/
+RUN mkdir /docker-entrypoint.d/
+ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
+
CMD ["unitd", "--no-daemon", "--control", "unix:/var/run/control.unit.sock"]
diff --git a/pkg/docker/Makefile b/pkg/docker/Makefile
index b4ed95f4..e826cb95 100644
--- a/pkg/docker/Makefile
+++ b/pkg/docker/Makefile
@@ -2,7 +2,7 @@
include ../../version
-DEFAULT_RELEASE := 2
+DEFAULT_RELEASE := 1
VERSION ?= $(NXT_VERSION)
RELEASE ?= $(DEFAULT_RELEASE)
diff --git a/pkg/docker/docker-entrypoint.sh b/pkg/docker/docker-entrypoint.sh
new file mode 100755
index 00000000..4ad7cb9a
--- /dev/null
+++ b/pkg/docker/docker-entrypoint.sh
@@ -0,0 +1,71 @@
+#!/usr/bin/env bash
+
+set -e
+
+curl_put()
+{
+ RET=`/usr/bin/curl -s -w '%{http_code}' -X PUT --data-binary @$1 --unix-socket /var/run/control.unit.sock http://localhost/$2`
+ RET_BODY=${RET::-3}
+ RET_STATUS=$(echo $RET | /usr/bin/tail -c 4)
+ if [ "$RET_STATUS" -ne "200" ]; then
+ echo "$0: Error: HTTP response status code is '$RET_STATUS'"
+ echo "$RET_BODY"
+ return 1
+ else
+ echo "$0: OK: HTTP response status code is '$RET_STATUS'"
+ echo "$RET_BODY"
+ fi
+ return 0
+}
+
+if [ "$1" = "unitd" ]; then
+ if /usr/bin/find "/var/lib/unit/" -mindepth 1 -print -quit 2>/dev/null | /bin/grep -q .; then
+ echo "$0: /var/lib/unit/ is not empty, skipping initial configuration..."
+ else
+ if /usr/bin/find "/docker-entrypoint.d/" -mindepth 1 -print -quit 2>/dev/null | /bin/grep -q .; then
+ echo "$0: /docker-entrypoint.d/ is not empty, launching Unit daemon to perform initial configuration..."
+ /usr/sbin/unitd --control unix:/var/run/control.unit.sock
+
+ while [ ! -S /var/run/control.unit.sock ]; do echo "$0: Waiting for control socket to be created..."; /bin/sleep 0.1; done
+ # even when the control socket exists, it does not mean unit has finished initialisation
+ # this curl call will get a reply once unit is fully launched
+ /usr/bin/curl -s -X GET --unix-socket /var/run/control.unit.sock http://localhost/
+
+ echo "$0: Looking for certificate bundles in /docker-entrypoint.d/..."
+ for f in $(/usr/bin/find /docker-entrypoint.d/ -type f -name "*.pem"); do
+ echo "$0: Uploading certificates bundle: $f"
+ curl_put $f "certificates/$(basename $f .pem)"
+ done
+
+ echo "$0: Looking for configuration snippets in /docker-entrypoint.d/..."
+ for f in $(/usr/bin/find /docker-entrypoint.d/ -type f -name "*.json"); do
+ echo "$0: Applying configuration $f";
+ curl_put $f "config"
+ done
+
+ echo "$0: Looking for shell scripts in /docker-entrypoint.d/..."
+ for f in $(/usr/bin/find /docker-entrypoint.d/ -type f -name "*.sh"); do
+ echo "$0: Launching $f";
+ "$f"
+ done
+
+ # warn on filetypes we don't know what to do with
+ for f in $(/usr/bin/find /docker-entrypoint.d/ -type f -not -name "*.sh" -not -name "*.json" -not -name "*.pem"); do
+ echo "$0: Ignoring $f";
+ done
+
+ echo "$0: Stopping Unit daemon after initial configuration..."
+ kill -TERM `/bin/cat /var/run/unit.pid`
+
+ while [ -S /var/run/control.unit.sock ]; do echo "$0: Waiting for control socket to be removed..."; /bin/sleep 0.1; done
+
+ echo
+ echo "$0: Unit initial configuration complete; ready for start up..."
+ echo
+ else
+ echo "$0: /docker-entrypoint.d/ is empty, skipping initial configuration..."
+ fi
+ fi
+fi
+
+exec "$@"
diff --git a/pkg/rpm/Makefile b/pkg/rpm/Makefile
index af6c61b1..4e970e45 100644
--- a/pkg/rpm/Makefile
+++ b/pkg/rpm/Makefile
@@ -2,7 +2,7 @@
include ../../version
-DEFAULT_RELEASE := 2
+DEFAULT_RELEASE := 1
VERSION ?= $(NXT_VERSION)
RELEASE ?= $(DEFAULT_RELEASE)
diff --git a/pkg/rpm/Makefile.go b/pkg/rpm/Makefile.go
index bdfb20ce..09dffd21 100644
--- a/pkg/rpm/Makefile.go
+++ b/pkg/rpm/Makefile.go
@@ -4,7 +4,7 @@ MODULE_SUFFIX_go= go
MODULE_SUMMARY_go= Go module for NGINX Unit
MODULE_VERSION_go= $(VERSION)
-MODULE_RELEASE_go= 2
+MODULE_RELEASE_go= 1
MODULE_CONFARGS_go= go --go-path=%{gopath}
MODULE_MAKEARGS_go= go
diff --git a/pkg/rpm/Makefile.jsc-common b/pkg/rpm/Makefile.jsc-common
index 68d7721d..d8c308de 100644
--- a/pkg/rpm/Makefile.jsc-common
+++ b/pkg/rpm/Makefile.jsc-common
@@ -4,7 +4,7 @@ MODULE_SUFFIX_jsc_common= jsc-common
MODULE_SUMMARY_jsc_common= Java shared packages for NGINX Unit
MODULE_VERSION_jsc_common= $(VERSION)
-MODULE_RELEASE_jsc_common= 2
+MODULE_RELEASE_jsc_common= 1
JAVA_ARCH_jsc_common= $(shell /usr/lib/jvm/java-1.8.0/bin/java -XshowSettings 2>&1 | grep -F -e os.arch | sed -e 's/^.*= //')
diff --git a/pkg/rpm/Makefile.jsc11 b/pkg/rpm/Makefile.jsc11
index 522e0bf2..38efa2a9 100644
--- a/pkg/rpm/Makefile.jsc11
+++ b/pkg/rpm/Makefile.jsc11
@@ -4,7 +4,7 @@ MODULE_SUFFIX_jsc11= jsc11
MODULE_SUMMARY_jsc11= Java 11 module for NGINX Unit
MODULE_VERSION_jsc11= $(VERSION)
-MODULE_RELEASE_jsc11= 2
+MODULE_RELEASE_jsc11= 1
MODULE_CONFARGS_jsc11= java --module=java11 --home=/usr/lib/jvm/java-11 --lib-path=/usr/lib/jvm/jre-11/lib/server --jars=/usr/share/unit-jsc-common/
MODULE_MAKEARGS_jsc11= java11
diff --git a/pkg/rpm/Makefile.jsc8 b/pkg/rpm/Makefile.jsc8
index 59ba9b8d..58e2368b 100644
--- a/pkg/rpm/Makefile.jsc8
+++ b/pkg/rpm/Makefile.jsc8
@@ -4,7 +4,7 @@ MODULE_SUFFIX_jsc8= jsc8
MODULE_SUMMARY_jsc8= Java 8 module for NGINX Unit
MODULE_VERSION_jsc8= $(VERSION)
-MODULE_RELEASE_jsc8= 2
+MODULE_RELEASE_jsc8= 1
JAVA_ARCH_jsc8= $(shell /usr/lib/jvm/java-1.8.0/bin/java -XshowSettings 2>&1 | grep -F -e os.arch | sed -e 's/^.*= //')
diff --git a/pkg/rpm/Makefile.perl b/pkg/rpm/Makefile.perl
index 8f408247..f59b7353 100644
--- a/pkg/rpm/Makefile.perl
+++ b/pkg/rpm/Makefile.perl
@@ -4,7 +4,7 @@ MODULE_SUFFIX_perl= perl
MODULE_SUMMARY_perl= Perl module for NGINX Unit
MODULE_VERSION_perl= $(VERSION)
-MODULE_RELEASE_perl= 2
+MODULE_RELEASE_perl= 1
MODULE_CONFARGS_perl= perl
MODULE_MAKEARGS_perl= perl
diff --git a/pkg/rpm/Makefile.php b/pkg/rpm/Makefile.php
index 9efa3ecf..8f39efc0 100644
--- a/pkg/rpm/Makefile.php
+++ b/pkg/rpm/Makefile.php
@@ -4,7 +4,7 @@ MODULE_SUFFIX_php= php
MODULE_SUMMARY_php= PHP module for NGINX Unit
MODULE_VERSION_php= $(VERSION)
-MODULE_RELEASE_php= 2
+MODULE_RELEASE_php= 1
MODULE_CONFARGS_php= php
MODULE_MAKEARGS_php= php
diff --git a/pkg/rpm/Makefile.python b/pkg/rpm/Makefile.python
index 4a1dfcad..334d62c1 100644
--- a/pkg/rpm/Makefile.python
+++ b/pkg/rpm/Makefile.python
@@ -4,7 +4,7 @@ MODULE_SUFFIX_python= python
MODULE_SUMMARY_python= Python module for NGINX Unit
MODULE_VERSION_python= $(VERSION)
-MODULE_RELEASE_python= 2
+MODULE_RELEASE_python= 1
MODULE_CONFARGS_python= python
MODULE_MAKEARGS_python= python
diff --git a/pkg/rpm/Makefile.python27 b/pkg/rpm/Makefile.python27
index add58d7b..95b392a9 100644
--- a/pkg/rpm/Makefile.python27
+++ b/pkg/rpm/Makefile.python27
@@ -4,7 +4,7 @@ MODULE_SUFFIX_python27= python2.7
MODULE_SUMMARY_python27= Python 2.7 module for NGINX Unit
MODULE_VERSION_python27= $(VERSION)
-MODULE_RELEASE_python27= 2
+MODULE_RELEASE_python27= 1
MODULE_CONFARGS_python27= python --config=python2.7-config
MODULE_MAKEARGS_python27= python2.7
diff --git a/pkg/rpm/Makefile.python34 b/pkg/rpm/Makefile.python34
index 75fc7085..83c0bdb6 100644
--- a/pkg/rpm/Makefile.python34
+++ b/pkg/rpm/Makefile.python34
@@ -4,7 +4,7 @@ MODULE_SUFFIX_python34= python3.4
MODULE_SUMMARY_python34= Python 3.4 module for NGINX Unit
MODULE_VERSION_python34= $(VERSION)
-MODULE_RELEASE_python34= 2
+MODULE_RELEASE_python34= 1
MODULE_CONFARGS_python34= python --config=python3.4-config
MODULE_MAKEARGS_python34= python3.4
diff --git a/pkg/rpm/Makefile.python35 b/pkg/rpm/Makefile.python35
index fd4d0026..6f866771 100644
--- a/pkg/rpm/Makefile.python35
+++ b/pkg/rpm/Makefile.python35
@@ -4,7 +4,7 @@ MODULE_SUFFIX_python35= python3.5
MODULE_SUMMARY_python35= Python 3.5 module for NGINX Unit
MODULE_VERSION_python35= $(VERSION)
-MODULE_RELEASE_python35= 2
+MODULE_RELEASE_python35= 1
MODULE_CONFARGS_python35= python --config=python3.5-config
MODULE_MAKEARGS_python35= python3.5
diff --git a/pkg/rpm/Makefile.python36 b/pkg/rpm/Makefile.python36
index 35df2e28..25e33968 100644
--- a/pkg/rpm/Makefile.python36
+++ b/pkg/rpm/Makefile.python36
@@ -4,7 +4,7 @@ MODULE_SUFFIX_python36= python3.6
MODULE_SUMMARY_python36= Python 3.6 module for NGINX Unit
MODULE_VERSION_python36= $(VERSION)
-MODULE_RELEASE_python36= 2
+MODULE_RELEASE_python36= 1
MODULE_CONFARGS_python36= python --config=python3.6-config
MODULE_MAKEARGS_python36= python3.6
diff --git a/pkg/rpm/Makefile.python37 b/pkg/rpm/Makefile.python37
index 9d52628e..ed9462b8 100644
--- a/pkg/rpm/Makefile.python37
+++ b/pkg/rpm/Makefile.python37
@@ -4,7 +4,7 @@ MODULE_SUFFIX_python37= python3.7
MODULE_SUMMARY_python37= Python 3.7 module for NGINX Unit
MODULE_VERSION_python37= $(VERSION)
-MODULE_RELEASE_python37= 2
+MODULE_RELEASE_python37= 1
MODULE_CONFARGS_python37= python --config=python3.7-config
MODULE_MAKEARGS_python37= python3.7
diff --git a/pkg/rpm/Makefile.ruby b/pkg/rpm/Makefile.ruby
index c34a193e..51c2949d 100644
--- a/pkg/rpm/Makefile.ruby
+++ b/pkg/rpm/Makefile.ruby
@@ -4,7 +4,7 @@ MODULE_SUFFIX_ruby= ruby
MODULE_SUMMARY_ruby= Ruby module for NGINX Unit
MODULE_VERSION_ruby= $(VERSION)
-MODULE_RELEASE_ruby= 2
+MODULE_RELEASE_ruby= 1
MODULE_CONFARGS_ruby= ruby
MODULE_MAKEARGS_ruby= ruby
diff --git a/pkg/rpm/rpmbuild/SOURCES/unit.logrotate b/pkg/rpm/rpmbuild/SOURCES/unit.logrotate
index 8fb00199..806e4594 100644
--- a/pkg/rpm/rpmbuild/SOURCES/unit.logrotate
+++ b/pkg/rpm/rpmbuild/SOURCES/unit.logrotate
@@ -1,5 +1,9 @@
/var/log/unit/*.log {
+ daily
missingok
+ rotate 7
+ compress
+ delaycompress
nocreate
notifempty
postrotate
diff --git a/src/go/unit/response.go b/src/go/unit/response.go
index 767d66b7..bb326ea5 100644
--- a/src/go/unit/response.go
+++ b/src/go/unit/response.go
@@ -63,7 +63,7 @@ func (r *response) WriteHeader(code int) {
for k, vv := range r.header {
for _, v := range vv {
fields++
- fields_size += len(k) + len(v)
+ fields_size += len(k) + len(v) + 2
}
}
diff --git a/src/nxt_clone.c b/src/nxt_clone.c
index 0fddd6c7..a2c376a3 100644
--- a/src/nxt_clone.c
+++ b/src/nxt_clone.c
@@ -127,9 +127,13 @@ nxt_clone_proc_map_write(nxt_task_t *task, const char *mapfile, pid_t pid,
nxt_errno);
}
+ close(mapfd);
+
return NXT_ERROR;
}
+ close(mapfd);
+
return NXT_OK;
}
diff --git a/src/nxt_errno.h b/src/nxt_errno.h
index e3ce8349..1b29ef2f 100644
--- a/src/nxt_errno.h
+++ b/src/nxt_errno.h
@@ -16,6 +16,7 @@ typedef int nxt_err_t;
#define NXT_ENOPATH ENOENT
#define NXT_ESRCH ESRCH
#define NXT_EINTR EINTR
+#define NXT_ENXIO ENXIO
#define NXT_ECHILD ECHILD
#define NXT_ENOMEM ENOMEM
#define NXT_EACCES EACCES
diff --git a/src/nxt_h1proto.c b/src/nxt_h1proto.c
index 39be4315..541fcb44 100644
--- a/src/nxt_h1proto.c
+++ b/src/nxt_h1proto.c
@@ -1293,7 +1293,7 @@ nxt_h1p_chunk_create(nxt_task_t *task, nxt_http_request_t *r, nxt_buf_t *out)
for (b = out; b != NULL; b = b->next) {
if (nxt_buf_is_last(b)) {
- tail = nxt_http_buf_mem(task, r, chunk_size);
+ tail = nxt_http_buf_mem(task, r, sizeof(tail_chunk));
if (nxt_slow_path(tail == NULL)) {
return NULL;
}
diff --git a/src/nxt_http_error.c b/src/nxt_http_error.c
index 1dcd8783..8e8b80f1 100644
--- a/src/nxt_http_error.c
+++ b/src/nxt_http_error.c
@@ -16,8 +16,12 @@ static const nxt_http_request_state_t nxt_http_request_send_error_body_state;
static const char error[] =
- "<html><head><title>Error</title></head>"
- "<body>Error.</body></html>\r\n";
+ "<!DOCTYPE html>"
+ "<title>Error %03d</title>"
+ "<p>Error %03d.\r\n";
+
+/* Two %03d (4 chars) patterns are replaced by status code (3 chars). */
+#define NXT_HTTP_ERROR_LEN (nxt_length(error) - 2)
void
@@ -49,7 +53,7 @@ nxt_http_request_error(nxt_task_t *task, nxt_http_request_t *r,
nxt_http_field_set(content_type, "Content-Type", "text/html");
r->resp.content_length = NULL;
- r->resp.content_length_n = nxt_length(error);
+ r->resp.content_length_n = NXT_HTTP_ERROR_LEN;
r->state = &nxt_http_request_send_error_body_state;
@@ -80,15 +84,13 @@ nxt_http_request_send_error_body(nxt_task_t *task, void *obj, void *data)
nxt_debug(task, "http request send error body");
- out = nxt_http_buf_mem(task, r, 0);
+ out = nxt_http_buf_mem(task, r, NXT_HTTP_ERROR_LEN);
if (nxt_slow_path(out == NULL)) {
goto fail;
}
- out->mem.start = (u_char *) error;
- out->mem.pos = out->mem.start;
- out->mem.free = out->mem.start + nxt_length(error);
- out->mem.end = out->mem.free;
+ out->mem.free = nxt_sprintf(out->mem.pos, out->mem.end, error,
+ r->status, r->status);
out->next = nxt_http_buf_last(r);
diff --git a/src/nxt_http_parse.c b/src/nxt_http_parse.c
index 5b009d96..e6e91454 100644
--- a/src/nxt_http_parse.c
+++ b/src/nxt_http_parse.c
@@ -162,7 +162,7 @@ static nxt_int_t
nxt_http_parse_request_line(nxt_http_request_parse_t *rp, u_char **pos,
u_char *end)
{
- u_char *p, ch, *after_slash, *exten, *args;
+ u_char *p, ch, *after_slash, *args;
nxt_int_t rc;
nxt_bool_t rest;
nxt_http_ver_t ver;
@@ -255,7 +255,6 @@ nxt_http_parse_request_line(nxt_http_request_parse_t *rp, u_char **pos,
rp->target_start = p;
after_slash = p + 1;
- exten = NULL;
args = NULL;
rest = 0;
@@ -274,7 +273,6 @@ continue_target:
}
after_slash = p + 1;
- exten = NULL;
continue;
case NXT_HTTP_TARGET_DOT:
@@ -283,7 +281,6 @@ continue_target:
goto rest_of_target;
}
- exten = p + 1;
continue;
case NXT_HTTP_TARGET_ARGS_MARK:
@@ -459,11 +456,6 @@ space_after_target:
rp->path.length = rp->target_end - rp->target_start;
}
- if (exten != NULL) {
- rp->exten.length = (rp->path.start + rp->path.length) - exten;
- rp->exten.start = exten;
- }
-
return nxt_http_parse_field_name(rp, pos, end);
}
@@ -846,7 +838,7 @@ static const uint8_t nxt_http_normal[32] nxt_aligned(32) = {
static nxt_int_t
nxt_http_parse_complex_target(nxt_http_request_parse_t *rp)
{
- u_char *p, *u, c, ch, high, *exten, *args;
+ u_char *p, *u, c, ch, high, *args;
enum {
sw_normal = 0,
@@ -872,7 +864,6 @@ nxt_http_parse_complex_target(nxt_http_request_parse_t *rp)
rp->path.start = u;
high = '\0';
- exten = NULL;
args = NULL;
while (p < rp->target_end) {
@@ -892,7 +883,6 @@ nxt_http_parse_complex_target(nxt_http_request_parse_t *rp)
switch (ch) {
case '/':
- exten = NULL;
state = sw_slash;
*u++ = ch;
continue;
@@ -905,10 +895,6 @@ nxt_http_parse_complex_target(nxt_http_request_parse_t *rp)
goto args;
case '#':
goto done;
- case '.':
- exten = u + 1;
- *u++ = ch;
- continue;
default:
*u++ = ch;
continue;
@@ -970,9 +956,11 @@ nxt_http_parse_complex_target(nxt_http_request_parse_t *rp)
state = sw_quoted;
continue;
case '?':
+ u--;
args = p;
goto args;
case '#':
+ u--;
goto done;
default:
state = sw_normal;
@@ -991,30 +979,42 @@ nxt_http_parse_complex_target(nxt_http_request_parse_t *rp)
}
switch (ch) {
+
case '/':
- state = sw_slash;
+ case '?':
+ case '#':
u -= 5;
+
for ( ;; ) {
if (u < rp->path.start) {
return NXT_HTTP_PARSE_INVALID;
}
+
if (*u == '/') {
u++;
break;
}
+
u--;
}
+
+ if (ch == '?') {
+ args = p;
+ goto args;
+ }
+
+ if (ch == '#') {
+ goto done;
+ }
+
+ state = sw_slash;
break;
case '%':
saved_state = state;
state = sw_quoted;
continue;
- case '?':
- args = p;
- goto args;
- case '#':
- goto done;
+
default:
state = sw_normal;
*u++ = ch;
@@ -1097,8 +1097,14 @@ nxt_http_parse_complex_target(nxt_http_request_parse_t *rp)
}
}
- if (state >= sw_quoted) {
- return NXT_HTTP_PARSE_INVALID;
+ if (state >= sw_dot) {
+ if (state >= sw_quoted) {
+ return NXT_HTTP_PARSE_INVALID;
+ }
+
+ /* "/." and "/.." must be normalized similar to "/./" and "/../". */
+ ch = '/';
+ goto again;
}
args:
@@ -1118,11 +1124,6 @@ done:
rp->path.length = u - rp->path.start;
- if (exten) {
- rp->exten.length = u - exten;
- rp->exten.start = exten;
- }
-
return NXT_OK;
}
diff --git a/src/nxt_http_parse.h b/src/nxt_http_parse.h
index a307ea73..d7ce5e4f 100644
--- a/src/nxt_http_parse.h
+++ b/src/nxt_http_parse.h
@@ -44,7 +44,6 @@ struct nxt_http_request_parse_s {
nxt_str_t path;
nxt_str_t args;
- nxt_str_t exten;
nxt_http_ver_t version;
diff --git a/src/nxt_http_static.c b/src/nxt_http_static.c
index 44b85389..48a989cf 100644
--- a/src/nxt_http_static.c
+++ b/src/nxt_http_static.c
@@ -94,9 +94,20 @@ nxt_http_static_handler(nxt_task_t *task, nxt_http_request_t *r,
if (nxt_slow_path(ret != NXT_OK)) {
switch (f->error) {
+ /*
+ * For Unix domain sockets "errno" is set to:
+ * - ENXIO on Linux;
+ * - EOPNOTSUPP on *BSD, MacOSX, and Solaris.
+ */
+
case NXT_ENOENT:
case NXT_ENOTDIR:
case NXT_ENAMETOOLONG:
+#if (NXT_LINUX)
+ case NXT_ENXIO:
+#else
+ case NXT_EOPNOTSUPP:
+#endif
level = NXT_LOG_ERR;
status = NXT_HTTP_NOT_FOUND;
break;
@@ -209,7 +220,6 @@ nxt_http_static_handler(nxt_task_t *task, nxt_http_request_t *r,
/* Not a file. */
nxt_file_close(task, f);
- f = NULL;
if (nxt_slow_path(!nxt_is_dir(&fi))) {
nxt_log(task, NXT_LOG_ERR, "\"%FN\" is not a regular file",
@@ -218,6 +228,8 @@ nxt_http_static_handler(nxt_task_t *task, nxt_http_request_t *r,
return NULL;
}
+ f = NULL;
+
r->status = NXT_HTTP_MOVED_PERMANENTLY;
r->resp.content_length_n = 0;
diff --git a/src/nxt_kqueue_engine.c b/src/nxt_kqueue_engine.c
index 0212b331..9edbc346 100644
--- a/src/nxt_kqueue_engine.c
+++ b/src/nxt_kqueue_engine.c
@@ -705,7 +705,10 @@ nxt_kqueue_poll(nxt_event_engine_t *engine, nxt_msec_t timeout)
nxt_log(&engine->task, level, "kevent(%d) failed %E",
engine->u.kqueue.fd, err);
- nxt_kqueue_error(engine);
+ if (err != NXT_EINTR) {
+ nxt_kqueue_error(engine);
+ }
+
return;
}
diff --git a/src/nxt_main_process.c b/src/nxt_main_process.c
index 44deb272..85685fbc 100644
--- a/src/nxt_main_process.c
+++ b/src/nxt_main_process.c
@@ -14,10 +14,6 @@
#include <nxt_cert.h>
#endif
-#ifdef NXT_LINUX
-#include <linux/sched.h>
-#endif
-
typedef struct {
nxt_socket_t socket;
@@ -661,7 +657,7 @@ nxt_main_start_worker_process(nxt_task_t *task, nxt_runtime_t *rt,
ret = nxt_user_cred_get(task, init->user_cred, group);
if (ret != NXT_OK) {
- return NXT_ERROR;
+ goto fail;
}
} else {
@@ -670,7 +666,7 @@ nxt_main_start_worker_process(nxt_task_t *task, nxt_runtime_t *rt,
{
nxt_alert(task, "cannot set user \"%V\" for app \"%V\": "
"missing capabilities", &app_conf->user, &app_conf->name);
- return NXT_ERROR;
+ goto fail;
}
if (app_conf->group.length > 0
@@ -680,7 +676,7 @@ nxt_main_start_worker_process(nxt_task_t *task, nxt_runtime_t *rt,
nxt_alert(task, "cannot set group \"%V\" for app \"%V\": "
"missing capabilities", &app_conf->group,
&app_conf->name);
- return NXT_ERROR;
+ goto fail;
}
last = nxt_pointer_to(init, sizeof(nxt_process_init_t));
@@ -702,10 +698,16 @@ nxt_main_start_worker_process(nxt_task_t *task, nxt_runtime_t *rt,
ret = nxt_init_set_isolation(task, init, app_conf->isolation);
if (nxt_slow_path(ret != NXT_OK)) {
- return NXT_ERROR;
+ goto fail;
}
return nxt_main_create_worker_process(task, rt, init);
+
+fail:
+
+ nxt_free(init);
+
+ return NXT_ERROR;
}
@@ -1012,52 +1014,50 @@ nxt_main_cleanup_worker_process(nxt_task_t *task, nxt_pid_t pid)
nxt_process_close_ports(task, process);
- if (!nxt_exiting) {
- nxt_runtime_process_each(rt, process) {
-
- if (process->pid == nxt_pid
- || process->pid == pid
- || nxt_queue_is_empty(&process->ports))
- {
- continue;
- }
-
- port = nxt_process_port_first(process);
+ if (nxt_exiting) {
+ if (rt->nprocesses <= 2) {
+ nxt_runtime_quit(task, 0);
+ }
- if (nxt_proc_remove_notify_matrix[ptype][port->type] == 0) {
- continue;
- }
+ return;
+ }
- buf = nxt_buf_mem_ts_alloc(task, task->thread->engine->mem_pool,
- sizeof(pid));
- if (nxt_slow_path(buf == NULL)) {
- continue;
- }
+ nxt_runtime_process_each(rt, process) {
- buf->mem.free = nxt_cpymem(buf->mem.free, &pid, sizeof(pid));
+ if (process->pid == nxt_pid
+ || process->pid == pid
+ || nxt_queue_is_empty(&process->ports))
+ {
+ continue;
+ }
- nxt_port_socket_write(task, port, NXT_PORT_MSG_REMOVE_PID,
- -1, init->stream, 0, buf);
- } nxt_runtime_process_loop;
- }
+ port = nxt_process_port_first(process);
- if (nxt_exiting) {
+ if (nxt_proc_remove_notify_matrix[ptype][port->type] == 0) {
+ continue;
+ }
- if (rt->nprocesses == 2) {
- nxt_runtime_quit(task, 0);
+ buf = nxt_buf_mem_ts_alloc(task, task->thread->engine->mem_pool,
+ sizeof(pid));
+ if (nxt_slow_path(buf == NULL)) {
+ continue;
}
- } else if (init != NULL) {
- if (init->restart != NULL) {
- if (init->type == NXT_PROCESS_ROUTER) {
- nxt_main_stop_worker_processes(task, rt);
- }
+ buf->mem.free = nxt_cpymem(buf->mem.free, &pid, sizeof(pid));
- init->restart(task, rt, init);
+ nxt_port_socket_write(task, port, NXT_PORT_MSG_REMOVE_PID,
+ -1, init->stream, 0, buf);
+ } nxt_runtime_process_loop;
- } else {
- nxt_free(init);
+ if (init->restart != NULL) {
+ if (init->type == NXT_PROCESS_ROUTER) {
+ nxt_main_stop_worker_processes(task, rt);
}
+
+ init->restart(task, rt, init);
+
+ } else {
+ nxt_free(init);
}
}
}
@@ -1311,6 +1311,11 @@ nxt_main_port_modules_handler(nxt_task_t *task, nxt_port_recv_msg_t *msg)
return;
}
+ if (nxt_exiting) {
+ nxt_debug(task, "ignoring discovered modules, exiting");
+ return;
+ }
+
port = nxt_runtime_port_find(task->thread->runtime, msg->port_msg.pid,
msg->port_msg.reply_port);
diff --git a/src/nxt_openssl.c b/src/nxt_openssl.c
index c01f92c8..53ed0381 100644
--- a/src/nxt_openssl.c
+++ b/src/nxt_openssl.c
@@ -599,7 +599,6 @@ nxt_openssl_conn_handshake(nxt_task_t *task, void *obj, void *data)
default:
case NXT_ERROR:
- c->socket.error = err;
nxt_openssl_conn_error(task, err, "SSL_do_handshake(%d) failed",
c->socket.fd);
@@ -644,7 +643,6 @@ nxt_openssl_conn_io_recvbuf(nxt_conn_t *c, nxt_buf_t *b)
n = nxt_openssl_conn_test_error(c->socket.task, c, ret, err,
NXT_OPENSSL_READ);
if (n == NXT_ERROR) {
- c->socket.error = err;
nxt_openssl_conn_error(c->socket.task, err,
"SSL_read(%d, %p, %uz) failed",
c->socket.fd, b->mem.free, size);
@@ -684,13 +682,7 @@ nxt_openssl_conn_io_send(nxt_task_t *task, nxt_sendbuf_t *sb, void *buf,
ret = SSL_write(tls->session, buf, size);
- if (ret <= 0) {
- err = nxt_socket_errno;
- sb->error = err;
-
- } else {
- err = 0;
- }
+ err = (ret <= 0) ? nxt_socket_errno : 0;
nxt_debug(task, "SSL_write(%d, %p, %uz): %d err:%d",
sb->socket, buf, size, ret, err);
@@ -701,15 +693,13 @@ nxt_openssl_conn_io_send(nxt_task_t *task, nxt_sendbuf_t *sb, void *buf,
c = tls->conn;
c->socket.write_ready = sb->ready;
- c->socket.error = sb->error;
n = nxt_openssl_conn_test_error(task, c, ret, err, NXT_OPENSSL_WRITE);
sb->ready = c->socket.write_ready;
- sb->error = c->socket.error;
if (n == NXT_ERROR) {
- sb->error = err;
+ sb->error = c->socket.error;
nxt_openssl_conn_error(task, err, "SSL_write(%d, %p, %uz) failed",
sb->socket, buf, size);
}
@@ -825,7 +815,6 @@ nxt_openssl_conn_io_shutdown(nxt_task_t *task, void *obj, void *data)
default:
case NXT_ERROR:
- c->socket.error = err;
nxt_openssl_conn_error(task, err, "SSL_shutdown(%d) failed",
c->socket.fd);
handler = c->write_state->error_handler;
@@ -886,6 +875,7 @@ nxt_openssl_conn_test_error(nxt_task_t *task, nxt_conn_t *c, int ret,
nxt_debug(task, "ERR_peek_error(): %l", lib_err);
if (sys_err != 0 || lib_err != 0) {
+ c->socket.error = sys_err;
return NXT_ERROR;
}
diff --git a/src/nxt_php_sapi.c b/src/nxt_php_sapi.c
index f5f115f5..7a5e0a3b 100644
--- a/src/nxt_php_sapi.c
+++ b/src/nxt_php_sapi.c
@@ -668,10 +668,10 @@ nxt_php_request_handler(nxt_unit_request_info_t *req)
SG(request_info).path_translated = NULL;
+ nxt_memzero(&file_handle, sizeof(file_handle));
+
file_handle.type = ZEND_HANDLE_FILENAME;
file_handle.filename = (char *) ctx->script_filename.start;
- file_handle.free_filename = 0;
- file_handle.opened_path = NULL;
nxt_unit_req_debug(req, "handle.filename = '%s'",
ctx->script_filename.start);
diff --git a/src/nxt_process.c b/src/nxt_process.c
index 638765a4..0cc9ccc4 100644
--- a/src/nxt_process.c
+++ b/src/nxt_process.c
@@ -42,7 +42,8 @@ nxt_bool_t nxt_proc_remove_notify_matrix[NXT_PROCESS_MAX][NXT_PROCESS_MAX] = {
static nxt_int_t
-nxt_process_worker_setup(nxt_task_t *task, nxt_process_t *process, int parentfd) {
+nxt_process_worker_setup(nxt_task_t *task, nxt_process_t *process, int parentfd)
+{
pid_t rpid, pid;
ssize_t n;
nxt_int_t parent_status;
@@ -87,11 +88,6 @@ nxt_process_worker_setup(nxt_task_t *task, nxt_process_t *process, int parentfd)
return NXT_ERROR;
}
- if (nxt_slow_path(close(parentfd) == -1)) {
- nxt_alert(task, "failed to close reader pipe fd");
- return NXT_ERROR;
- }
-
if (nxt_slow_path(parent_status != NXT_OK)) {
return parent_status;
}
@@ -152,29 +148,26 @@ nxt_process_create(nxt_task_t *task, nxt_process_t *process)
init = process->init;
#if (NXT_HAVE_CLONE)
- pid = nxt_clone(SIGCHLD|init->isolation.clone.flags);
-#else
- pid = fork();
-#endif
-
+ pid = nxt_clone(SIGCHLD | init->isolation.clone.flags);
if (nxt_slow_path(pid < 0)) {
-#if (NXT_HAVE_CLONE)
nxt_alert(task, "clone() failed while creating \"%s\" %E",
init->name, nxt_errno);
+ goto cleanup;
+ }
#else
+ pid = fork();
+ if (nxt_slow_path(pid < 0)) {
nxt_alert(task, "fork() failed while creating \"%s\" %E",
init->name, nxt_errno);
-#endif
-
- return pid;
+ goto cleanup;
}
+#endif
if (pid == 0) {
/* Child. */
if (nxt_slow_path(close(pipefd[1]) == -1)) {
nxt_alert(task, "failed to close writer pipe fd");
- return NXT_ERROR;
}
ret = nxt_process_worker_setup(task, process, pipefd[0]);
@@ -182,6 +175,10 @@ nxt_process_create(nxt_task_t *task, nxt_process_t *process)
exit(1);
}
+ if (nxt_slow_path(close(pipefd[0]) == -1)) {
+ nxt_alert(task, "failed to close writer pipe fd");
+ }
+
/*
* Explicitly return 0 to notice the caller function this is the child.
* The caller must return to the event engine work queue loop.
@@ -191,10 +188,6 @@ nxt_process_create(nxt_task_t *task, nxt_process_t *process)
/* Parent. */
- if (nxt_slow_path(close(pipefd[0]) != 0)) {
- nxt_alert(task, "failed to close pipe: %E", nxt_errno);
- }
-
/*
* At this point, the child process is blocked reading the
* pipe fd to get its real pid (rpid).
@@ -211,14 +204,14 @@ nxt_process_create(nxt_task_t *task, nxt_process_t *process)
if (nxt_slow_path(write(pipefd[1], &pid, sizeof(pid)) == -1)) {
nxt_alert(task, "failed to write real pid");
- goto fail_cleanup;
+ goto fail;
}
#if (NXT_HAVE_CLONE_NEWUSER)
if ((init->isolation.clone.flags & CLONE_NEWUSER) == CLONE_NEWUSER) {
ret = nxt_clone_proc_map(task, pid, &init->isolation.clone);
if (nxt_slow_path(ret != NXT_OK)) {
- goto fail_cleanup;
+ goto fail;
}
}
#endif
@@ -227,16 +220,16 @@ nxt_process_create(nxt_task_t *task, nxt_process_t *process)
if (nxt_slow_path(write(pipefd[1], &ret, sizeof(ret)) == -1)) {
nxt_alert(task, "failed to write status");
- goto fail_cleanup;
+ goto fail;
}
process->pid = pid;
nxt_runtime_process_add(task, process);
- return pid;
+ goto cleanup;
-fail_cleanup:
+fail:
ret = NXT_ERROR;
@@ -244,13 +237,21 @@ fail_cleanup:
nxt_alert(task, "failed to write status");
}
- if (nxt_slow_path(close(pipefd[1]) != 0)) {
+ waitpid(pid, NULL, 0);
+
+ pid = -1;
+
+cleanup:
+
+ if (nxt_slow_path(close(pipefd[0]) != 0)) {
nxt_alert(task, "failed to close pipe: %E", nxt_errno);
}
- waitpid(pid, NULL, 0);
+ if (nxt_slow_path(close(pipefd[1]) != 0)) {
+ nxt_alert(task, "failed to close pipe: %E", nxt_errno);
+ }
- return -1;
+ return pid;
}
diff --git a/src/test/nxt_http_parse_test.c b/src/test/nxt_http_parse_test.c
index 5498cb1f..8dcbc061 100644
--- a/src/test/nxt_http_parse_test.c
+++ b/src/test/nxt_http_parse_test.c
@@ -11,7 +11,6 @@
typedef struct {
nxt_str_t method;
nxt_str_t target;
- nxt_str_t exten;
nxt_str_t args;
u_char version[8];
@@ -66,7 +65,6 @@ static nxt_http_parse_test_case_t nxt_http_test_cases[] = {
nxt_string("GET"),
nxt_string("/"),
nxt_null_string,
- nxt_null_string,
"HTTP/1.0",
0, 0, 0
}}
@@ -78,7 +76,6 @@ static nxt_http_parse_test_case_t nxt_http_test_cases[] = {
{ .request_line = {
nxt_string("XXX-METHOD"),
nxt_string("/d.ir/fi+le.ext?key=val"),
- nxt_string("ext"),
nxt_string("key=val"),
"HTTP/1.2",
0, 0, 0
@@ -91,7 +88,6 @@ static nxt_http_parse_test_case_t nxt_http_test_cases[] = {
{ .request_line = {
nxt_string("GET"),
nxt_string("/di.r/?"),
- nxt_null_string,
nxt_string(""),
"HTTP/1.0",
0, 0, 0
@@ -135,7 +131,6 @@ static nxt_http_parse_test_case_t nxt_http_test_cases[] = {
nxt_string("GET"),
nxt_string("/."),
nxt_null_string,
- nxt_null_string,
"HTTP/1.0",
1, 0, 0
}}
@@ -148,7 +143,6 @@ static nxt_http_parse_test_case_t nxt_http_test_cases[] = {
nxt_string("GET"),
nxt_string("/#"),
nxt_null_string,
- nxt_null_string,
"HTTP/1.0",
1, 0, 0
}}
@@ -160,7 +154,6 @@ static nxt_http_parse_test_case_t nxt_http_test_cases[] = {
{ .request_line = {
nxt_string("GET"),
nxt_string("/?#"),
- nxt_null_string,
nxt_string(""),
"HTTP/1.0",
1, 0, 0
@@ -174,7 +167,6 @@ static nxt_http_parse_test_case_t nxt_http_test_cases[] = {
nxt_string("GET"),
nxt_string("//"),
nxt_null_string,
- nxt_null_string,
"HTTP/1.0",
1, 0, 0
}}
@@ -187,7 +179,6 @@ static nxt_http_parse_test_case_t nxt_http_test_cases[] = {
nxt_string("GET"),
nxt_string("/%20"),
nxt_null_string,
- nxt_null_string,
"HTTP/1.0",
0, 1, 0
}}
@@ -200,7 +191,6 @@ static nxt_http_parse_test_case_t nxt_http_test_cases[] = {
nxt_string("GET"),
nxt_string("/ a"),
nxt_null_string,
- nxt_null_string,
"HTTP/1.0",
0, 0, 1
}}
@@ -212,7 +202,6 @@ static nxt_http_parse_test_case_t nxt_http_test_cases[] = {
{ .request_line = {
nxt_string("GET"),
nxt_string("/na %20me.ext?args"),
- nxt_string("ext"),
nxt_string("args"),
"HTTP/1.0",
0, 1, 1
@@ -225,7 +214,6 @@ static nxt_http_parse_test_case_t nxt_http_test_cases[] = {
{ .request_line = {
nxt_string("GET"),
nxt_string("/ HTTP/1.0"),
- nxt_string("0"),
nxt_null_string,
"HTTP/1.1",
0, 0, 1
@@ -740,16 +728,6 @@ nxt_http_parse_test_request_line(nxt_http_request_parse_t *rp,
return NXT_ERROR;
}
- if (rp->exten.start != test->exten.start
- && !nxt_strstr_eq(&rp->exten, &test->exten))
- {
- nxt_log_alert(log, "http parse test case failed:\n"
- " - request:\n\"%V\"\n"
- " - exten: \"%V\" (expected: \"%V\")",
- request, &rp->exten, &test->exten);
- return NXT_ERROR;
- }
-
if (rp->args.start != test->args.start
&& !nxt_strstr_eq(&rp->args, &test->args))
{
diff --git a/test/test_static.py b/test/test_static.py
index 573669a3..4bdd83ed 100644
--- a/test/test_static.py
+++ b/test/test_static.py
@@ -1,4 +1,5 @@
import os
+import socket
import unittest
from unit.applications.proto import TestApplicationProto
@@ -169,6 +170,29 @@ class TestStatic(TestApplicationProto):
self.get(url='/ди ректория/фа йл')['body'], 'blah', 'dir name 2'
)
+ def test_static_unix_socket(self):
+ sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
+ sock.bind(self.testdir + '/assets/unix_socket')
+
+ self.assertEqual(self.get(url='/unix_socket')['status'], 404, 'socket')
+
+ sock.close()
+
+ def test_static_unix_fifo(self):
+ os.mkfifo(self.testdir + '/assets/fifo')
+
+ self.assertEqual(self.get(url='/fifo')['status'], 404, 'fifo')
+
+ def test_static_symlink(self):
+ os.symlink(self.testdir + '/assets/dir', self.testdir + '/assets/link')
+
+ self.assertEqual(self.get(url='/dir')['status'], 301, 'dir')
+ self.assertEqual(self.get(url='/dir/file')['status'], 200, 'file')
+ self.assertEqual(self.get(url='/link')['status'], 301, 'symlink dir')
+ self.assertEqual(
+ self.get(url='/link/file')['status'], 200, 'symlink file'
+ )
+
def test_static_head(self):
resp = self.head(url='/')
self.assertEqual(resp['status'], 200, 'status')
diff --git a/test/unit/applications/lang/go.py b/test/unit/applications/lang/go.py
index 15ac1cd9..18345828 100644
--- a/test/unit/applications/lang/go.py
+++ b/test/unit/applications/lang/go.py
@@ -12,7 +12,8 @@ class TestApplicationGo(TestApplicationProto):
go_app = TestApplicationGo()
go_app.testdir = unit.testdir
- if go_app.prepare_env('empty', 'app').returncode == 0:
+ proc = go_app.prepare_env('empty', 'app')
+ if proc and proc.returncode == 0:
cls.available['modules']['go'] = []
return unit if not complete_check else unit.complete()
@@ -23,18 +24,23 @@ class TestApplicationGo(TestApplicationProto):
env = os.environ.copy()
env['GOPATH'] = self.pardir + '/go'
- process = Popen(
- [
- 'go',
- 'build',
- '-o',
- self.testdir + '/go/' + name,
- self.current_dir + '/go/' + script + '/' + name + '.go',
- ],
- env=env,
- )
- process.communicate()
+ try:
+ process = Popen(
+ [
+ 'go',
+ 'build',
+ '-o',
+ self.testdir + '/go/' + name,
+ self.current_dir + '/go/' + script + '/' + name + '.go',
+ ],
+ env=env,
+ )
+
+ process.communicate()
+
+ except:
+ return None
return process
diff --git a/test/unit/applications/lang/java.py b/test/unit/applications/lang/java.py
index 40bf3662..bcf87f59 100644
--- a/test/unit/applications/lang/java.py
+++ b/test/unit/applications/lang/java.py
@@ -63,8 +63,12 @@ class TestApplicationJava(TestApplicationProto):
]
javac.extend(src)
- process = Popen(javac)
- process.communicate()
+ try:
+ process = Popen(javac)
+ process.communicate()
+
+ except:
+ self.fail('Cann\'t run javac process.')
self._load_conf(
{
diff --git a/version b/version
index 427db61b..33ee1242 100644
--- a/version
+++ b/version
@@ -1,5 +1,5 @@
# Copyright (C) NGINX, Inc.
-NXT_VERSION=1.11.0
-NXT_VERNUM=11100
+NXT_VERSION=1.12.0
+NXT_VERNUM=11200