Skip to content

Commit b400ccd

Browse files
committed
Merged with the default branch.
2 parents fafd441 + b77895d commit b400ccd

File tree

149 files changed

+4699
-1946
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

149 files changed

+4699
-1946
lines changed

.hgtags

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,4 @@ ad6aad2450c256d4f1a3c32f7091a78dbbc4a6d1 1.23.0-1
5757
5c7ce0da580ef6e83c729dd012e976f22acbac27 1.24.0-1
5858
54ffe5ce4fb3c4304faf6d342d9b17dee2c745ac 1.25.0
5959
aa207ced9712132040e6153ceccdaf04c112d02c 1.25.0-1
60+
2be7b623fbfafdb470d832a28abb1cd55c76e04f 1.26.0

CHANGES

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,33 @@
11

2+
Changes with Unit 1.26.0 18 Nov 2021
3+
4+
*) Change: the "share" option now specifies the entire path to the files
5+
it serves, rather than a document root directory to be prepended to
6+
the request URI.
7+
8+
*) Feature: automatic adjustment of existing configurations to the new
9+
"share" behavior when updating from previous versions.
10+
11+
*) Feature: variables support in the "share" option.
12+
13+
*) Feature: multiple paths in the "share" option.
14+
15+
*) Feature: variables support in the "chroot" option.
16+
17+
*) Feature: PHP opcache is shared between application processes.
18+
19+
*) Feature: request routing by the query string.
20+
21+
*) Bugfix: the router and app processes could crash when the requests
22+
limit was reached by asynchronous or multithreaded apps.
23+
24+
*) Bugfix: established WebSocket connections could stop reading frames
25+
from the client after the corresponding listener had been
26+
reconfigured.
27+
28+
*) Bugfix: fixed building with glibc 2.34, notably Fedora 35.
29+
30+
231
Changes with Unit 1.25.0 19 Aug 2021
332

433
*) Feature: client IP address replacement from a specified HTTP header
@@ -20,7 +49,7 @@ Changes with Unit 1.25.0 19 Aug 2021
2049
multiple certificate bundles in a listener if the client did not use
2150
SNI.
2251

23-
*) Bugfix: the router process could crash with frequent mutithreaded
52+
*) Bugfix: the router process could crash with frequent multithreaded
2453
application reconfiguration.
2554

2655
*) Bugfix: compatibility issues with some Python ASGI apps, notably

auto/make

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ $echo >> $NXT_MAKEFILE
5959
$echo "NXT_LIB_UNIT_OBJS = \\" >> $NXT_MAKEFILE
6060
$echo " $NXT_BUILD_DIR/src/nxt_lvlhsh.o \\" >> $NXT_MAKEFILE
6161
$echo " $NXT_BUILD_DIR/src/nxt_murmur_hash.o \\" >> $NXT_MAKEFILE
62+
$echo " $NXT_BUILD_DIR/src/nxt_socket_msg.o \\" >> $NXT_MAKEFILE
6263
$echo " $NXT_BUILD_DIR/src/nxt_websocket.o \\" >> $NXT_MAKEFILE
6364

6465
for nxt_src in $NXT_LIB_UNIT_SRCS

auto/sockets

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,58 @@ nxt_feature_test="#include <stdio.h>
158158
}"
159159
. auto/feature
160160

161+
if [ $nxt_found = no ]; then
162+
$echo
163+
$echo $0: error: no msghdr.msg_control struct member.
164+
$echo
165+
exit 1;
166+
fi
167+
168+
169+
nxt_feature="sockopt SO_PASSCRED"
170+
nxt_feature_name=NXT_HAVE_SOCKOPT_SO_PASSCRED
171+
nxt_feature_run=
172+
nxt_feature_incs=
173+
nxt_feature_libs=
174+
nxt_feature_test="#define _GNU_SOURCE
175+
#include <sys/socket.h>
176+
177+
int main() {
178+
return SO_PASSCRED == 0;
179+
}"
180+
. auto/feature
181+
182+
183+
if [ $nxt_found = yes ]; then
184+
nxt_feature="struct ucred"
185+
nxt_feature_name=NXT_HAVE_UCRED
186+
nxt_feature_run=
187+
nxt_feature_incs=
188+
nxt_feature_libs=
189+
nxt_feature_test="#define _GNU_SOURCE
190+
#include <sys/socket.h>
191+
#include <sys/un.h>
192+
193+
int main() {
194+
return sizeof(struct ucred);
195+
}"
196+
. auto/feature
197+
fi
198+
199+
200+
nxt_feature="struct cmsgcred"
201+
nxt_feature_name=NXT_HAVE_MSGHDR_CMSGCRED
202+
nxt_feature_run=
203+
nxt_feature_incs=
204+
nxt_feature_libs=
205+
nxt_feature_test="#define _GNU_SOURCE
206+
#include <sys/socket.h>
207+
208+
int main() {
209+
return sizeof(struct cmsgcred);
210+
}"
211+
. auto/feature
212+
161213

162214
nxt_feature="sys/filio.h"
163215
nxt_feature_name=NXT_HAVE_SYS_FILIO_H

auto/sources

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ NXT_LIB_SRCS=" \
1313
src/nxt_mem_map.c \
1414
src/nxt_socket.c \
1515
src/nxt_socketpair.c \
16+
src/nxt_socket_msg.c \
1617
src/nxt_credential.c \
1718
src/nxt_isolation.c \
1819
src/nxt_process.c \
@@ -170,6 +171,7 @@ NXT_TEST_SRCS=" \
170171
src/test/nxt_rbtree1_test.c \
171172
src/test/nxt_http_parse_test.c \
172173
src/test/nxt_strverscmp_test.c \
174+
src/test/nxt_base64_test.c \
173175
"
174176

175177

docs/changes.xml

Lines changed: 120 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,125 @@
55
<change_log title="unit">
66

77

8+
<changes apply="unit-jsc18" ver="1.26.0" rev="1"
9+
date="2021-11-18" time="18:00:00 +0300"
10+
packager="Andrei Belov &lt;[email protected]&gt;">
11+
12+
<change>
13+
<para>
14+
Initial release of Java 18 module for NGINX Unit.
15+
</para>
16+
</change>
17+
18+
</changes>
19+
20+
21+
<changes apply="unit-python3.10" ver="1.26.0" rev="1"
22+
date="2021-11-18" time="18:00:00 +0300"
23+
packager="Andrei Belov &lt;[email protected]&gt;">
24+
25+
<change>
26+
<para>
27+
Initial release of Python 3.10 module for NGINX Unit.
28+
</para>
29+
</change>
30+
31+
</changes>
32+
33+
34+
<changes apply="unit-php
35+
unit-python unit-python2.7
36+
unit-python3.4 unit-python3.5 unit-python3.6 unit-python3.7
37+
unit-python3.8 unit-python3.9
38+
unit-go
39+
unit-perl
40+
unit-ruby
41+
unit-jsc-common unit-jsc8 unit-jsc10 unit-jsc11 unit-jsc13
42+
unit-jsc14 unit-jsc15 unit-jsc16 unit-jsc17"
43+
ver="1.26.0" rev="1"
44+
date="2021-11-18" time="18:00:00 +0300"
45+
packager="Andrei Belov &lt;[email protected]&gt;">
46+
47+
<change>
48+
<para>
49+
NGINX Unit updated to 1.26.0.
50+
</para>
51+
</change>
52+
53+
</changes>
54+
55+
56+
<changes apply="unit" ver="1.26.0" rev="1"
57+
date="2021-11-18" time="18:00:00 +0300"
58+
packager="Andrei Belov &lt;[email protected]&gt;">
59+
60+
<change type="change">
61+
<para>
62+
the "share" option now specifies the entire path to the files it serves,
63+
rather than a document root directory to be prepended to the request URI.
64+
</para>
65+
</change>
66+
67+
<change type="feature">
68+
<para>
69+
automatic adjustment of existing configurations to the new "share" behavior
70+
when updating from previous versions.
71+
</para>
72+
</change>
73+
74+
<change type="feature">
75+
<para>
76+
variables support in the "share" option.
77+
</para>
78+
</change>
79+
80+
<change type="feature">
81+
<para>
82+
multiple paths in the "share" option.
83+
</para>
84+
</change>
85+
86+
<change type="feature">
87+
<para>
88+
variables support in the "chroot" option.
89+
</para>
90+
</change>
91+
92+
<change type="feature">
93+
<para>
94+
PHP opcache is shared between application processes.
95+
</para>
96+
</change>
97+
98+
<change type="feature">
99+
<para>
100+
request routing by the query string.
101+
</para>
102+
</change>
103+
104+
<change type="bugfix">
105+
<para>
106+
the router and app processes could crash when the requests limit was reached
107+
by asynchronous or multithreaded apps.
108+
</para>
109+
</change>
110+
111+
<change type="bugfix">
112+
<para>
113+
established WebSocket connections could stop reading frames from the client
114+
after the corresponding listener had been reconfigured.
115+
</para>
116+
</change>
117+
118+
<change type="bugfix">
119+
<para>
120+
fixed building with glibc 2.34, notably Fedora 35.
121+
</para>
122+
</change>
123+
124+
</changes>
125+
126+
8127
<changes apply="unit-php
9128
unit-python unit-python2.7
10129
unit-python3.4 unit-python3.5 unit-python3.6 unit-python3.7
@@ -77,7 +196,7 @@ bundles in a listener if the client did not use SNI.
77196

78197
<change type="bugfix">
79198
<para>
80-
the router process could crash with frequent mutithreaded application
199+
the router process could crash with frequent multithreaded application
81200
reconfiguration.
82201
</para>
83202
</change>

go/nxt_cgo_lib.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010
#include <nxt_unit_request.h>
1111

1212

13-
static ssize_t nxt_cgo_port_send(nxt_unit_ctx_t *, nxt_unit_port_t *port,
13+
static ssize_t nxt_cgo_port_send(nxt_unit_ctx_t *ctx, nxt_unit_port_t *port,
1414
const void *buf, size_t buf_size, const void *oob, size_t oob_size);
15-
static ssize_t nxt_cgo_port_recv(nxt_unit_ctx_t *, nxt_unit_port_t *port,
16-
void *buf, size_t buf_size, void *oob, size_t oob_size);
15+
static ssize_t nxt_cgo_port_recv(nxt_unit_ctx_t *ctx, nxt_unit_port_t *port,
16+
void *buf, size_t buf_size, void *oob, size_t *oob_size);
1717

1818
int
1919
nxt_cgo_run(uintptr_t handler)
@@ -30,6 +30,7 @@ nxt_cgo_run(uintptr_t handler)
3030
init.callbacks.port_send = nxt_cgo_port_send;
3131
init.callbacks.port_recv = nxt_cgo_port_recv;
3232
init.callbacks.shm_ack_handler = nxt_go_shm_ack_handler;
33+
init.callbacks.ready_handler = nxt_go_ready;
3334

3435
init.data = (void *) handler;
3536

@@ -57,7 +58,7 @@ nxt_cgo_port_send(nxt_unit_ctx_t *ctx, nxt_unit_port_t *port,
5758

5859
static ssize_t
5960
nxt_cgo_port_recv(nxt_unit_ctx_t *ctx, nxt_unit_port_t *port,
60-
void *buf, size_t buf_size, void *oob, size_t oob_size)
61+
void *buf, size_t buf_size, void *oob, size_t *oob_size)
6162
{
6263
return nxt_go_port_recv(port->id.pid, port->id.id,
6364
buf, buf_size, oob, oob_size);

go/port.go

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -110,17 +110,21 @@ func nxt_go_add_port(ctx *C.nxt_unit_ctx_t, p *C.nxt_unit_port_t) C.int {
110110
p.in_fd = -1
111111
p.out_fd = -1
112112

113-
if new_port.key.id == 65535 {
114-
go func(ctx *C.nxt_unit_ctx_t) {
115-
C.nxt_unit_run_shared(ctx);
116-
}(ctx)
117-
}
113+
return C.NXT_UNIT_OK
114+
}
115+
116+
//export nxt_go_ready
117+
func nxt_go_ready(ctx *C.nxt_unit_ctx_t) C.int {
118+
go func(ctx *C.nxt_unit_ctx_t) {
119+
C.nxt_unit_run_shared(ctx)
120+
}(ctx)
118121

119122
return C.NXT_UNIT_OK
120123
}
121124

122125
//export nxt_go_remove_port
123-
func nxt_go_remove_port(unit *C.nxt_unit_t, p *C.nxt_unit_port_t) {
126+
func nxt_go_remove_port(unit *C.nxt_unit_t, ctx *C.nxt_unit_ctx_t,
127+
p *C.nxt_unit_port_t) {
124128

125129
key := port_key{
126130
pid: int(p.id.pid),
@@ -165,7 +169,7 @@ func nxt_go_port_send(pid C.int, id C.int, buf unsafe.Pointer, buf_size C.int,
165169

166170
//export nxt_go_port_recv
167171
func nxt_go_port_recv(pid C.int, id C.int, buf unsafe.Pointer, buf_size C.int,
168-
oob unsafe.Pointer, oob_size C.int) C.ssize_t {
172+
oob unsafe.Pointer, oob_size *C.size_t) C.ssize_t {
169173

170174
key := port_key{
171175
pid: int(pid),
@@ -180,7 +184,7 @@ func nxt_go_port_recv(pid C.int, id C.int, buf unsafe.Pointer, buf_size C.int,
180184
}
181185

182186
n, oobn, _, _, err := p.rcv.ReadMsgUnix(GoBytes(buf, buf_size),
183-
GoBytes(oob, oob_size))
187+
GoBytes(oob, C.int(*oob_size)))
184188

185189
if err != nil {
186190
if nerr, ok := err.(*net.OpError); ok {
@@ -192,6 +196,9 @@ func nxt_go_port_recv(pid C.int, id C.int, buf unsafe.Pointer, buf_size C.int,
192196
nxt_go_warn("read result %d (%d), %s", n, oobn, err)
193197

194198
n = -1
199+
200+
} else {
201+
*oob_size = C.size_t(oobn)
195202
}
196203

197204
return C.ssize_t(n)

0 commit comments

Comments
 (0)