Skip to content

Commit 3f99951

Browse files
authored
Merge branch 'main' into fix-49848
2 parents 4c7229c + 51f4ff2 commit 3f99951

File tree

140 files changed

+2344
-881
lines changed

Some content is hidden

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

140 files changed

+2344
-881
lines changed

.eslintrc.js

+1
Original file line numberDiff line numberDiff line change
@@ -361,5 +361,6 @@ module.exports = {
361361
WritableStream: 'readable',
362362
WritableStreamDefaultWriter: 'readable',
363363
WritableStreamDefaultController: 'readable',
364+
WebSocket: 'readable',
364365
},
365366
};

.github/CODEOWNERS

+4-4
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@
2020
/LICENSE @nodejs/tsc
2121
/onboarding.md @nodejs/tsc
2222

23-
# website
24-
/doc/api_assets @nodejs/website
25-
/doc/template.html @nodejs/website
26-
/tools/doc @nodejs/website
23+
# nodejs.org website
24+
/doc/api_assets @nodejs/nodejs-website
25+
/doc/template.html @nodejs/nodejs-website
26+
/tools/doc @nodejs/web-infra
2727

2828
# streams
2929

CHANGELOG.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ release.
3434
</tr>
3535
<tr>
3636
<td valign="top">
37-
<b><a href="doc/changelogs/CHANGELOG_V20.md#20.7.0">20.7.0</a></b><br/>
37+
<b><a href="doc/changelogs/CHANGELOG_V20.md#20.8.0">20.8.0</a></b><br/>
38+
<a href="doc/changelogs/CHANGELOG_V20.md#20.7.0">20.7.0</a><br/>
3839
<a href="doc/changelogs/CHANGELOG_V20.md#20.6.1">20.6.1</a><br/>
3940
<a href="doc/changelogs/CHANGELOG_V20.md#20.6.0">20.6.0</a><br/>
4041
<a href="doc/changelogs/CHANGELOG_V20.md#20.5.1">20.5.1</a><br/>

android_configure.py

+1
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ def patch_android():
7070
GYP_DEFINES += " v8_target_arch=" + arch
7171
GYP_DEFINES += " android_target_arch=" + arch
7272
GYP_DEFINES += " host_os=" + host_os + " OS=android"
73+
GYP_DEFINES += " android_ndk_path=" + android_ndk_path
7374
os.environ['GYP_DEFINES'] = GYP_DEFINES
7475

7576
if os.path.exists("./configure"):

benchmark/error/format-list.js

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
'use strict';
2+
3+
const common = require('../common.js');
4+
5+
const bench = common.createBenchmark(main, {
6+
n: [1e7],
7+
input: [
8+
'',
9+
'a',
10+
'a,b',
11+
'a,b,c',
12+
'a,b,c,d',
13+
],
14+
type: [
15+
'undefined',
16+
'and',
17+
'or',
18+
],
19+
}, {
20+
flags: ['--expose-internals'],
21+
});
22+
23+
function main({ n, input, type }) {
24+
const {
25+
formatList,
26+
} = require('internal/errors');
27+
28+
const list = input.split(',');
29+
30+
if (type === 'undefined') {
31+
bench.start();
32+
for (let i = 0; i < n; ++i) {
33+
formatList(list);
34+
}
35+
bench.end(n);
36+
return;
37+
}
38+
39+
bench.start();
40+
for (let i = 0; i < n; ++i) {
41+
formatList(list, type);
42+
}
43+
bench.end(n);
44+
}

benchmark/streams/writable-manywrites.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const common = require('../common');
44
const Writable = require('stream').Writable;
55

66
const bench = common.createBenchmark(main, {
7-
n: [2e6],
7+
n: [1e5],
88
sync: ['yes', 'no'],
99
writev: ['yes', 'no'],
1010
callback: ['yes', 'no'],
@@ -13,7 +13,7 @@ const bench = common.createBenchmark(main, {
1313

1414
function main({ n, sync, writev, callback, len }) {
1515
const b = Buffer.allocUnsafe(len);
16-
const s = new Writable();
16+
const s = new Writable({ highWaterMark: 16 * 1024 });
1717
sync = sync === 'yes';
1818

1919
const writecb = (cb) => {

common.gypi

+1-1
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@
230230
],
231231
},],
232232
['OS == "android"', {
233-
'cflags': [ '-fPIC' ],
233+
'cflags': [ '-fPIC', '-I<(android_ndk_path)/sources/android/cpufeatures' ],
234234
'ldflags': [ '-fPIC' ]
235235
}],
236236
],

deps/openssl/openssl-cl_asm.gypi

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
'conditions': [
3-
['target_arch=="ppc64" and OS=="aix"', {
3+
['target_arch=="ppc64" and OS in ("aix", "os400")', {
44
'includes': ['config/archs/aix64-gcc-as/asm/openssl-cl.gypi'],
55
}, 'target_arch=="ppc64" and OS=="linux" and node_byteorder =="little"', {
66
'includes': ['config/archs/linux-ppc64le/asm/openssl-cl.gypi'],

deps/openssl/openssl-cl_asm_avx2.gypi

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
'conditions': [
3-
['target_arch=="ppc64" and OS=="aix"', {
3+
['target_arch=="ppc64" and OS in ("aix", "os400")', {
44
'includes': ['config/archs/aix64-gcc-as/asm_avx2/openssl-cl.gypi'],
55
}, 'target_arch=="ppc64" and OS=="linux" and node_byteorder =="little"', {
66
'includes': ['config/archs/linux-ppc64le/asm_avx2/openssl-cl.gypi'],

deps/openssl/openssl-cl_no_asm.gypi

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
'conditions': [
3-
['target_arch=="ppc64" and OS=="aix"', {
3+
['target_arch=="ppc64" and OS in ("aix", "os400")', {
44
'includes': ['config/archs/aix64-gcc-as/no-asm/openssl-cl.gypi'],
55
}, 'target_arch=="ppc64" and OS=="linux" and node_byteorder =="little"', {
66
'includes': ['config/archs/linux-ppc64le/no-asm/openssl-cl.gypi'],

deps/openssl/openssl-fips_asm.gypi

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
'conditions': [
3-
['target_arch=="ppc64" and OS=="aix"', {
3+
['target_arch=="ppc64" and OS in ("aix", "os400")', {
44
'includes': ['config/archs/aix64-gcc-as/asm/openssl-fips.gypi'],
55
}, 'target_arch=="ppc64" and OS=="linux" and node_byteorder =="little"', {
66
'includes': ['config/archs/linux-ppc64le/asm/openssl-fips.gypi'],

deps/openssl/openssl-fips_asm_avx2.gypi

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
'conditions': [
3-
['target_arch=="ppc64" and OS=="aix"', {
3+
['target_arch=="ppc64" and OS in ("aix", "os400")', {
44
'includes': ['config/archs/aix64-gcc-as/asm_avx2/openssl-fips.gypi'],
55
}, 'target_arch=="ppc64" and OS=="linux" and node_byteorder =="little"', {
66
'includes': ['config/archs/linux-ppc64le/asm_avx2/openssl-fips.gypi'],

deps/openssl/openssl-fips_no_asm.gypi

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
'defines': ['OPENSSL_NO_ASM'],
33
'conditions': [
4-
['target_arch=="ppc64" and OS=="aix"', {
4+
['target_arch=="ppc64" and OS in ("aix", "os400")', {
55
'includes': ['config/archs/aix64-gcc-as/no-asm/openssl-fips.gypi'],
66
}, 'target_arch=="ppc64" and OS=="linux" and node_byteorder =="little"', {
77
'includes': ['config/archs/linux-ppc64le/no-asm/openssl-fips.gypi'],

deps/openssl/openssl_asm.gypi

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
'conditions': [
3-
['target_arch=="ppc64" and OS=="aix"', {
3+
['target_arch=="ppc64" and OS in ("aix", "os400")', {
44
'includes': ['config/archs/aix64-gcc-as/asm/openssl.gypi'],
55
}, 'target_arch=="ppc64" and OS=="linux" and node_byteorder =="little"', {
66
'includes': ['config/archs/linux-ppc64le/asm/openssl.gypi'],

deps/openssl/openssl_asm_avx2.gypi

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
'conditions': [
3-
['target_arch=="ppc64" and OS=="aix"', {
3+
['target_arch=="ppc64" and OS in ("aix", "os400")', {
44
'includes': ['config/archs/aix64-gcc-as/asm_avx2/openssl.gypi'],
55
}, 'target_arch=="ppc64" and OS=="linux" and node_byteorder =="little"', {
66
'includes': ['config/archs/linux-ppc64le/asm_avx2/openssl.gypi'],

deps/openssl/openssl_common.gypi

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
],
1414
# build options specific to OS
1515
'conditions': [
16-
[ 'OS=="aix"', {
16+
[ 'OS in ("aix", "os400")', {
1717
# AIX is missing /usr/include/endian.h
1818
'defines': [
1919
'__LITTLE_ENDIAN=1234',

deps/openssl/openssl_no_asm.gypi

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
'defines': ['OPENSSL_NO_ASM'],
33
'conditions': [
4-
['target_arch=="ppc64" and OS=="aix"', {
4+
['target_arch=="ppc64" and OS in ("aix", "os400")', {
55
'includes': ['config/archs/aix64-gcc-as/no-asm/openssl.gypi'],
66
}, 'target_arch=="ppc64" and OS=="linux" and node_byteorder =="little"', {
77
'includes': ['config/archs/linux-ppc64le/no-asm/openssl.gypi'],

deps/uvwasi/include/uvwasi.h

+10-1
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,13 @@
55
extern "C" {
66
#endif
77

8+
#include "uv.h"
89
#include "wasi_serdes.h"
910
#include "wasi_types.h"
1011

1112
#define UVWASI_VERSION_MAJOR 0
1213
#define UVWASI_VERSION_MINOR 0
13-
#define UVWASI_VERSION_PATCH 18
14+
#define UVWASI_VERSION_PATCH 19
1415
#define UVWASI_VERSION_HEX ((UVWASI_VERSION_MAJOR << 16) | \
1516
(UVWASI_VERSION_MINOR << 8) | \
1617
(UVWASI_VERSION_PATCH))
@@ -47,17 +48,25 @@ typedef struct uvwasi_s {
4748
char* env_buf;
4849
uvwasi_size_t env_buf_size;
4950
const uvwasi_mem_t* allocator;
51+
uv_loop_t* loop;
5052
} uvwasi_t;
5153

5254
typedef struct uvwasi_preopen_s {
5355
const char* mapped_path;
5456
const char* real_path;
5557
} uvwasi_preopen_t;
5658

59+
typedef struct uvwasi_preopen_socket_s {
60+
const char* address;
61+
int port;
62+
} uvwasi_preopen_socket_t;
63+
5764
typedef struct uvwasi_options_s {
5865
uvwasi_size_t fd_table_size;
5966
uvwasi_size_t preopenc;
6067
uvwasi_preopen_t* preopens;
68+
uvwasi_size_t preopen_socketc;
69+
uvwasi_preopen_socket_t* preopen_sockets;
6170
uvwasi_size_t argc;
6271
const char** argv;
6372
const char** envp;

deps/uvwasi/src/fd_table.c

+52-17
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ static uvwasi_errno_t uvwasi__insert_stdio(uvwasi_t* uvwasi,
3737
err = uvwasi_fd_table_insert(uvwasi,
3838
table,
3939
fd,
40+
NULL,
4041
name,
4142
name,
4243
type,
@@ -58,6 +59,7 @@ static uvwasi_errno_t uvwasi__insert_stdio(uvwasi_t* uvwasi,
5859
uvwasi_errno_t uvwasi_fd_table_insert(uvwasi_t* uvwasi,
5960
struct uvwasi_fd_table_t* table,
6061
uv_file fd,
62+
uv_tcp_t* sock,
6163
const char* mapped_path,
6264
const char* real_path,
6365
uvwasi_filetype_t type,
@@ -78,29 +80,40 @@ uvwasi_errno_t uvwasi_fd_table_insert(uvwasi_t* uvwasi,
7880
char* rp_copy;
7981
char* np_copy;
8082

81-
mp_len = strlen(mapped_path);
82-
rp_len = strlen(real_path);
83+
if (type != UVWASI_FILETYPE_SOCKET_STREAM) {
84+
mp_len = strlen(mapped_path);
85+
rp_len = strlen(real_path);
86+
} else {
87+
mp_len = 0;
88+
rp_len = 0;
89+
rp_copy = NULL;
90+
mp_copy = NULL;
91+
np_copy = NULL;
92+
}
93+
8394
/* Reserve room for the mapped path, real path, and normalized mapped path. */
8495
entry = (struct uvwasi_fd_wrap_t*)
8596
uvwasi__malloc(uvwasi, sizeof(*entry) + mp_len + mp_len + rp_len + 3);
8697
if (entry == NULL)
8798
return UVWASI_ENOMEM;
8899

89-
mp_copy = (char*)(entry + 1);
90-
rp_copy = mp_copy + mp_len + 1;
91-
np_copy = rp_copy + rp_len + 1;
92-
memcpy(mp_copy, mapped_path, mp_len);
93-
mp_copy[mp_len] = '\0';
94-
memcpy(rp_copy, real_path, rp_len);
95-
rp_copy[rp_len] = '\0';
96-
97-
/* Calculate the normalized version of the mapped path, as it will be used for
98-
any path calculations on this fd. Use the length of the mapped path as an
99-
upper bound for the normalized path length. */
100-
err = uvwasi__normalize_path(mp_copy, mp_len, np_copy, mp_len);
101-
if (err) {
102-
uvwasi__free(uvwasi, entry);
103-
goto exit;
100+
if (type != UVWASI_FILETYPE_SOCKET_STREAM) {
101+
mp_copy = (char*)(entry + 1);
102+
rp_copy = mp_copy + mp_len + 1;
103+
np_copy = rp_copy + rp_len + 1;
104+
memcpy(mp_copy, mapped_path, mp_len);
105+
mp_copy[mp_len] = '\0';
106+
memcpy(rp_copy, real_path, rp_len);
107+
rp_copy[rp_len] = '\0';
108+
109+
/* Calculate the normalized version of the mapped path, as it will be used for
110+
any path calculations on this fd. Use the length of the mapped path as an
111+
upper bound for the normalized path length. */
112+
err = uvwasi__normalize_path(mp_copy, mp_len, np_copy, mp_len);
113+
if (err) {
114+
uvwasi__free(uvwasi, entry);
115+
goto exit;
116+
}
104117
}
105118

106119
uv_rwlock_wrlock(&table->rwlock);
@@ -150,6 +163,7 @@ uvwasi_errno_t uvwasi_fd_table_insert(uvwasi_t* uvwasi,
150163

151164
entry->id = index;
152165
entry->fd = fd;
166+
entry->sock = sock;
153167
entry->path = mp_copy;
154168
entry->real_path = rp_copy;
155169
entry->normalized_path = np_copy;
@@ -280,6 +294,7 @@ uvwasi_errno_t uvwasi_fd_table_insert_preopen(uvwasi_t* uvwasi,
280294
return uvwasi_fd_table_insert(uvwasi,
281295
table,
282296
fd,
297+
NULL,
283298
path,
284299
real_path,
285300
UVWASI_FILETYPE_DIRECTORY,
@@ -290,6 +305,26 @@ uvwasi_errno_t uvwasi_fd_table_insert_preopen(uvwasi_t* uvwasi,
290305
}
291306

292307

308+
uvwasi_errno_t uvwasi_fd_table_insert_preopen_socket(uvwasi_t* uvwasi,
309+
struct uvwasi_fd_table_t* table,
310+
uv_tcp_t* sock) {
311+
if (table == NULL || sock == NULL)
312+
return UVWASI_EINVAL;
313+
314+
return uvwasi_fd_table_insert(uvwasi,
315+
table,
316+
-1,
317+
sock,
318+
NULL,
319+
NULL,
320+
UVWASI_FILETYPE_SOCKET_STREAM,
321+
UVWASI__RIGHTS_SOCKET_BASE,
322+
UVWASI__RIGHTS_SOCKET_INHERITING,
323+
1,
324+
NULL);
325+
}
326+
327+
293328
uvwasi_errno_t uvwasi_fd_table_get(struct uvwasi_fd_table_t* table,
294329
const uvwasi_fd_t id,
295330
struct uvwasi_fd_wrap_t** wrap,

deps/uvwasi/src/fd_table.h

+5
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ struct uvwasi_options_s;
1111
struct uvwasi_fd_wrap_t {
1212
uvwasi_fd_t id;
1313
uv_file fd;
14+
uv_tcp_t* sock;
1415
char* path;
1516
char* real_path;
1617
char* normalized_path;
@@ -35,6 +36,7 @@ void uvwasi_fd_table_free(struct uvwasi_s* uvwasi,
3536
uvwasi_errno_t uvwasi_fd_table_insert(struct uvwasi_s* uvwasi,
3637
struct uvwasi_fd_table_t* table,
3738
uv_file fd,
39+
uv_tcp_t* sock,
3840
const char* mapped_path,
3941
const char* real_path,
4042
uvwasi_filetype_t type,
@@ -47,6 +49,9 @@ uvwasi_errno_t uvwasi_fd_table_insert_preopen(struct uvwasi_s* uvwasi,
4749
const uv_file fd,
4850
const char* path,
4951
const char* real_path);
52+
uvwasi_errno_t uvwasi_fd_table_insert_preopen_socket(struct uvwasi_s* uvwasi,
53+
struct uvwasi_fd_table_t* table,
54+
uv_tcp_t* sock);
5055
uvwasi_errno_t uvwasi_fd_table_get(struct uvwasi_fd_table_t* table,
5156
const uvwasi_fd_t id,
5257
struct uvwasi_fd_wrap_t** wrap,

0 commit comments

Comments
 (0)