Skip to content
This repository was archived by the owner on Oct 15, 2020. It is now read-only.

Commit 60ed062

Browse files
committed
meta: merge node/master into node-chakracore/master
Merge 8eca6b8 as of 2018-03-27 This commit was automatically generated. For any problems, please contact jackhorton Reviewed-By: chakrabot <[email protected]>
2 parents c073aa3 + 8eca6b8 commit 60ed062

Some content is hidden

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

44 files changed

+7473
-16793
lines changed

Diff for: deps/chakrashim/include/v8-version.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#define V8_MAJOR_VERSION 6
1212
#define V8_MINOR_VERSION 5
1313
#define V8_BUILD_NUMBER 254
14-
#define V8_PATCH_LEVEL 41
14+
#define V8_PATCH_LEVEL 43
1515

1616
// Use 1 for candidates and 0 otherwise.
1717
// (Boolean macro values are not supported by all preprocessors.)

Diff for: deps/openssl/openssl.gypi

+3
Original file line numberDiff line numberDiff line change
@@ -1268,6 +1268,9 @@
12681268
# the real driver but that poses a security liability when an attacker
12691269
# is able to create a malicious DLL in one of the default search paths.
12701270
'OPENSSL_NO_HW',
1271+
1272+
# Disable NPN (Next Protocol Negotiation), superseded by ALPN.
1273+
'OPENSSL_NO_NEXTPROTONEG',
12711274
],
12721275
'openssl_default_defines_win': [
12731276
'MK1MF_BUILD',

Diff for: deps/v8/include/v8-version.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#define V8_MAJOR_VERSION 6
1212
#define V8_MINOR_VERSION 5
1313
#define V8_BUILD_NUMBER 254
14-
#define V8_PATCH_LEVEL 41
14+
#define V8_PATCH_LEVEL 43
1515

1616
// Use 1 for candidates and 0 otherwise.
1717
// (Boolean macro values are not supported by all preprocessors.)

Diff for: doc/api/assert.md

+5-7
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ Please note that this will also deactivate the colors in the REPL.
7373
> Stability: 0 - Deprecated: Use strict mode instead.
7474
7575
When accessing `assert` directly instead of using the `strict` property, the
76-
[Abstract Equality Comparison][] will be used for any function without a
77-
"strict" in its name (e.g. [`assert.deepEqual()`][]).
76+
[Abstract Equality Comparison][] will be used for any function without "strict"
77+
in its name, such as [`assert.deepEqual()`][].
7878

7979
It can be accessed using:
8080

@@ -83,11 +83,9 @@ const assert = require('assert');
8383
```
8484

8585
It is recommended to use the [`strict mode`][] instead as the
86-
[Abstract Equality Comparison][] can often have surprising results. Especially
87-
in case of [`assert.deepEqual()`][] as the used comparison rules there are very
88-
lax.
89-
90-
E.g.
86+
[Abstract Equality Comparison][] can often have surprising results. This is
87+
especially true for [`assert.deepEqual()`][], where the comparison rules are
88+
lax:
9189

9290
```js
9391
// WARNING: This does not throw an AssertionError!

Diff for: doc/api/buffer.md

+33-34
Original file line numberDiff line numberDiff line change
@@ -48,58 +48,57 @@ const buf6 = Buffer.from('tést', 'latin1');
4848

4949
## `Buffer.from()`, `Buffer.alloc()`, and `Buffer.allocUnsafe()`
5050

51-
In versions of Node.js prior to v6, `Buffer` instances were created using the
51+
In versions of Node.js prior to 6.0.0, `Buffer` instances were created using the
5252
`Buffer` constructor function, which allocates the returned `Buffer`
5353
differently based on what arguments are provided:
5454

55-
* Passing a number as the first argument to `Buffer()` (e.g. `new Buffer(10)`),
55+
* Passing a number as the first argument to `Buffer()` (e.g. `new Buffer(10)`)
5656
allocates a new `Buffer` object of the specified size. Prior to Node.js 8.0.0,
5757
the memory allocated for such `Buffer` instances is *not* initialized and
5858
*can contain sensitive data*. Such `Buffer` instances *must* be subsequently
5959
initialized by using either [`buf.fill(0)`][`buf.fill()`] or by writing to the
60-
`Buffer` completely. While this behavior is *intentional* to improve
61-
performance, development experience has demonstrated that a more explicit
62-
distinction is required between creating a fast-but-uninitialized `Buffer`
63-
versus creating a slower-but-safer `Buffer`. Starting in Node.js 8.0.0,
64-
`Buffer(num)` and `new Buffer(num)` will return a `Buffer` with initialized
65-
memory.
60+
entire `Buffer`. While this behavior is *intentional* to improve performance,
61+
development experience has demonstrated that a more explicit distinction is
62+
required between creating a fast-but-uninitialized `Buffer` versus creating a
63+
slower-but-safer `Buffer`. Starting in Node.js 8.0.0, `Buffer(num)` and
64+
`new Buffer(num)` will return a `Buffer` with initialized memory.
6665
* Passing a string, array, or `Buffer` as the first argument copies the
6766
passed object's data into the `Buffer`.
6867
* Passing an [`ArrayBuffer`] or a [`SharedArrayBuffer`] returns a `Buffer` that
6968
shares allocated memory with the given array buffer.
7069

71-
Because the behavior of `new Buffer()` changes significantly based on the type
72-
of value passed as the first argument, applications that do not properly
73-
validate the input arguments passed to `new Buffer()`, or that fail to
74-
appropriately initialize newly allocated `Buffer` content, can inadvertently
75-
introduce security and reliability issues into their code.
70+
Because the behavior of `new Buffer()` is different depending on the type of the
71+
first argument, security and reliability issues can be inadvertently introduced
72+
into applications when argument validation or `Buffer` initialization is not
73+
performed.
7674

77-
To make the creation of `Buffer` instances more reliable and less error prone,
75+
To make the creation of `Buffer` instances more reliable and less error-prone,
7876
the various forms of the `new Buffer()` constructor have been **deprecated**
7977
and replaced by separate `Buffer.from()`, [`Buffer.alloc()`], and
8078
[`Buffer.allocUnsafe()`] methods.
8179

8280
*Developers should migrate all existing uses of the `new Buffer()` constructors
8381
to one of these new APIs.*
8482

85-
* [`Buffer.from(array)`] returns a new `Buffer` containing a *copy* of the provided
86-
octets.
83+
* [`Buffer.from(array)`] returns a new `Buffer` that *contains a copy* of the
84+
provided octets.
8785
* [`Buffer.from(arrayBuffer[, byteOffset [, length]])`][`Buffer.from(arrayBuffer)`]
88-
returns a new `Buffer` that *shares* the same allocated memory as the given
86+
returns a new `Buffer` that *shares the same allocated memory* as the given
8987
[`ArrayBuffer`].
90-
* [`Buffer.from(buffer)`] returns a new `Buffer` containing a *copy* of the
88+
* [`Buffer.from(buffer)`] returns a new `Buffer` that *contains a copy* of the
9189
contents of the given `Buffer`.
92-
* [`Buffer.from(string[, encoding])`][`Buffer.from(string)`] returns a new `Buffer`
93-
containing a *copy* of the provided string.
94-
* [`Buffer.alloc(size[, fill[, encoding]])`][`Buffer.alloc()`] returns a "filled"
95-
`Buffer` instance of the specified size. This method can be significantly
96-
slower than [`Buffer.allocUnsafe(size)`][`Buffer.allocUnsafe()`] but ensures
97-
that newly created `Buffer` instances never contain old and potentially
98-
sensitive data.
90+
* [`Buffer.from(string[, encoding])`][`Buffer.from(string)`] returns a new
91+
`Buffer` that *contains a copy* of the provided string.
92+
* [`Buffer.alloc(size[, fill[, encoding]])`][`Buffer.alloc()`] returns a new
93+
initialized `Buffer` of the specified size. This method is slower than
94+
[`Buffer.allocUnsafe(size)`][`Buffer.allocUnsafe()`] but guarantees that newly
95+
created `Buffer` instances never contain old data that is potentially
96+
sensitive.
9997
* [`Buffer.allocUnsafe(size)`][`Buffer.allocUnsafe()`] and
10098
[`Buffer.allocUnsafeSlow(size)`][`Buffer.allocUnsafeSlow()`] each return a
101-
new `Buffer` of the specified `size` whose content *must* be initialized
102-
using either [`buf.fill(0)`][`buf.fill()`] or written to completely.
99+
new uninitialized `Buffer` of the specified `size`. Because the `Buffer` is
100+
uninitialized, the allocated segment of memory might contain old data that is
101+
potentially sensitive.
103102

104103
`Buffer` instances returned by [`Buffer.allocUnsafe()`] *may* be allocated off
105104
a shared internal memory pool if `size` is less than or equal to half
@@ -112,13 +111,13 @@ added: v5.10.0
112111
-->
113112

114113
Node.js can be started using the `--zero-fill-buffers` command line option to
115-
force all newly allocated `Buffer` instances created using either
116-
`new Buffer(size)`, [`Buffer.allocUnsafe()`], [`Buffer.allocUnsafeSlow()`] or
117-
`new SlowBuffer(size)` to be *automatically zero-filled* upon creation. Use of
118-
this flag *changes the default behavior* of these methods and *can have a significant
119-
impact* on performance. Use of the `--zero-fill-buffers` option is recommended
120-
only when necessary to enforce that newly allocated `Buffer` instances cannot
121-
contain potentially sensitive data.
114+
cause all newly allocated `Buffer` instances to be zero-filled upon creation by
115+
default, including buffers returned by `new Buffer(size)`,
116+
[`Buffer.allocUnsafe()`], [`Buffer.allocUnsafeSlow()`], and `new
117+
SlowBuffer(size)`. Use of this flag can have a significant negative impact on
118+
performance. Use of the `--zero-fill-buffers` option is recommended only when
119+
necessary to enforce that newly allocated `Buffer` instances cannot contain old
120+
data that is potentially sensitive.
122121

123122
```txt
124123
$ node --zero-fill-buffers

Diff for: doc/api/crypto.md

-4
Original file line numberDiff line numberDiff line change
@@ -2412,10 +2412,6 @@ the `crypto`, `tls`, and `https` modules and are generally specific to OpenSSL.
24122412
<td><code>DH_NOT_SUITABLE_GENERATOR</code></td>
24132413
<td></td>
24142414
</tr>
2415-
<tr>
2416-
<td><code>NPN_ENABLED</code></td>
2417-
<td></td>
2418-
</tr>
24192415
<tr>
24202416
<td><code>ALPN_ENABLED</code></td>
24212417
<td></td>

Diff for: doc/api/deprecations.md

+8
Original file line numberDiff line numberDiff line change
@@ -971,6 +971,14 @@ initialization vectors. It is recommended to derive a key using
971971
[`crypto.createDecipheriv()`][] to obtain the [`Cipher`][] and [`Decipher`][]
972972
objects respectively.
973973
974+
<a id="DEP0107"></a>
975+
### DEP0107: tls.convertNPNProtocols()
976+
977+
Type: Runtime
978+
979+
This was an undocumented helper function not intended for use outside Node.js
980+
core and obsoleted by the removal of NPN (Next Protocol Negotiation) support.
981+
974982
[`--pending-deprecation`]: cli.html#cli_pending_deprecation
975983
[`Buffer.allocUnsafeSlow(size)`]: buffer.html#buffer_class_method_buffer_allocunsafeslow_size
976984
[`Buffer.from(array)`]: buffer.html#buffer_class_method_buffer_from_array

Diff for: doc/api/dgram.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ the error is emitted as an `'error'` event on the `socket` object.
319319
Offset and length are optional but both *must* be set if either are used.
320320
They are supported only when the first argument is a `Buffer` or `Uint8Array`.
321321

322-
Example of sending a UDP packet to a random port on `localhost`;
322+
Example of sending a UDP packet to a port on `localhost`;
323323

324324
```js
325325
const dgram = require('dgram');
@@ -330,8 +330,8 @@ client.send(message, 41234, 'localhost', (err) => {
330330
});
331331
```
332332

333-
Example of sending a UDP packet composed of multiple buffers to a random port
334-
on `127.0.0.1`;
333+
Example of sending a UDP packet composed of multiple buffers to a port on
334+
`127.0.0.1`;
335335

336336
```js
337337
const dgram = require('dgram');

Diff for: doc/api/fs.md

+6
Original file line numberDiff line numberDiff line change
@@ -528,6 +528,12 @@ The numeric group identifier of the group that owns the file (POSIX).
528528

529529
A numeric device identifier if the file is considered "special".
530530

531+
### stats.size
532+
533+
* Value: {number}
534+
535+
The size of the file in bytes.
536+
531537
### stats.blksize
532538

533539
* Value: {number}

Diff for: doc/api/tls.md

+12-40
Original file line numberDiff line numberDiff line change
@@ -104,22 +104,17 @@ not required and a default ECDHE curve will be used. The `ecdhCurve` property
104104
can be used when creating a TLS Server to specify the list of names of supported
105105
curves to use, see [`tls.createServer()`] for more info.
106106

107-
### ALPN, NPN, and SNI
107+
### ALPN and SNI
108108

109109
<!-- type=misc -->
110110

111-
ALPN (Application-Layer Protocol Negotiation Extension), NPN (Next
112-
Protocol Negotiation) and, SNI (Server Name Indication) are TLS
113-
handshake extensions:
111+
ALPN (Application-Layer Protocol Negotiation Extension) and
112+
SNI (Server Name Indication) are TLS handshake extensions:
114113

115-
* ALPN/NPN - Allows the use of one TLS server for multiple protocols (HTTP,
116-
SPDY, HTTP/2)
114+
* ALPN - Allows the use of one TLS server for multiple protocols (HTTP, HTTP/2)
117115
* SNI - Allows the use of one TLS server for multiple hostnames with different
118116
SSL certificates.
119117

120-
Use of ALPN is recommended over NPN. The NPN extension has never been
121-
formally defined or documented and generally not recommended for use.
122-
123118
### Client-initiated renegotiation attack mitigation
124119

125120
<!-- type=misc -->
@@ -332,12 +327,9 @@ server. If `tlsSocket.authorized` is `false`, then `socket.authorizationError`
332327
is set to describe how authorization failed. Note that depending on the settings
333328
of the TLS server, unauthorized connections may still be accepted.
334329

335-
The `tlsSocket.npnProtocol` and `tlsSocket.alpnProtocol` properties are strings
336-
that contain the selected NPN and ALPN protocols, respectively. When both NPN
337-
and ALPN extensions are received, ALPN takes precedence over NPN and the next
338-
protocol is selected by ALPN.
339-
340-
When ALPN has no selected protocol, `tlsSocket.alpnProtocol` returns `false`.
330+
The `tlsSocket.alpnProtocol` property is a string that contains the selected
331+
ALPN protocol. When ALPN has no selected protocol, `tlsSocket.alpnProtocol`
332+
equals `false`.
341333

342334
The `tlsSocket.servername` property is a string containing the server name
343335
requested via SNI.
@@ -468,7 +460,6 @@ changes:
468460
(`isServer` is true) may optionally set `requestCert` to true to request a
469461
client certificate.
470462
* `rejectUnauthorized`: Optional, see [`tls.createServer()`][]
471-
* `NPNProtocols`: Optional, see [`tls.createServer()`][]
472463
* `ALPNProtocols`: Optional, see [`tls.createServer()`][]
473464
* `SNICallback`: Optional, see [`tls.createServer()`][]
474465
* `session` {Buffer} An optional `Buffer` instance containing a TLS session.
@@ -509,9 +500,9 @@ regardless of whether or not the server's certificate has been authorized. It
509500
is the client's responsibility to check the `tlsSocket.authorized` property to
510501
determine if the server certificate was signed by one of the specified CAs. If
511502
`tlsSocket.authorized === false`, then the error can be found by examining the
512-
`tlsSocket.authorizationError` property. If either ALPN or NPN was used,
513-
the `tlsSocket.alpnProtocol` or `tlsSocket.npnProtocol` properties can be
514-
checked to determine the negotiated protocol.
503+
`tlsSocket.authorizationError` property. If ALPN was used, the
504+
`tlsSocket.alpnProtocol` property can be checked to determine the negotiated
505+
protocol.
515506

516507
### tlsSocket.address()
517508
<!-- YAML
@@ -841,8 +832,7 @@ changes:
841832
description: The `lookup` option is supported now.
842833
- version: v8.0.0
843834
pr-url: https://github.com/nodejs/node/pull/11984
844-
description: The `ALPNProtocols` and `NPNProtocols` options can
845-
be `Uint8Array`s now.
835+
description: The `ALPNProtocols` option can be a `Uint8Array` now.
846836
- version: v5.3.0, v4.7.0
847837
pr-url: https://github.com/nodejs/node/pull/4246
848838
description: The `secureContext` option is supported now.
@@ -869,12 +859,6 @@ changes:
869859
verified against the list of supplied CAs. An `'error'` event is emitted if
870860
verification fails; `err.code` contains the OpenSSL error code. Defaults to
871861
`true`.
872-
* `NPNProtocols` {string[]|Buffer[]|Uint8Array[]|Buffer|Uint8Array}
873-
An array of strings, `Buffer`s or `Uint8Array`s, or a single `Buffer` or
874-
`Uint8Array` containing supported NPN protocols. `Buffer`s should have the
875-
format `[len][name][len][name]...` e.g. `0x05hello0x05world`, where the
876-
first byte is the length of the next protocol name. Passing an array is
877-
usually much simpler, e.g. `['hello', 'world']`.
878862
* `ALPNProtocols`: {string[]|Buffer[]|Uint8Array[]|Buffer|Uint8Array}
879863
An array of strings, `Buffer`s or `Uint8Array`s, or a single `Buffer` or
880864
`Uint8Array` containing the supported ALPN protocols. `Buffer`s should have
@@ -1116,8 +1100,7 @@ changes:
11161100
description: The `options` parameter can now include `clientCertEngine`.
11171101
- version: v8.0.0
11181102
pr-url: https://github.com/nodejs/node/pull/11984
1119-
description: The `ALPNProtocols` and `NPNProtocols` options can
1120-
be `Uint8Array`s now.
1103+
description: The `ALPNProtocols` option can be a `Uint8Array` now.
11211104
- version: v5.0.0
11221105
pr-url: https://github.com/nodejs/node/pull/2564
11231106
description: ALPN options are supported now.
@@ -1136,23 +1119,13 @@ changes:
11361119
* `rejectUnauthorized` {boolean} If not `false` the server will reject any
11371120
connection which is not authorized with the list of supplied CAs. This
11381121
option only has an effect if `requestCert` is `true`. Defaults to `true`.
1139-
* `NPNProtocols` {string[]|Buffer[]|Uint8Array[]|Buffer|Uint8Array}
1140-
An array of strings, `Buffer`s or `Uint8Array`s, or a single `Buffer` or
1141-
`Uint8Array` containing supported NPN protocols. `Buffer`s should have the
1142-
format `[len][name][len][name]...` e.g. `0x05hello0x05world`, where the
1143-
first byte is the length of the next protocol name. Passing an array is
1144-
usually much simpler, e.g. `['hello', 'world']`.
1145-
(Protocols should be ordered by their priority.)
11461122
* `ALPNProtocols`: {string[]|Buffer[]|Uint8Array[]|Buffer|Uint8Array}
11471123
An array of strings, `Buffer`s or `Uint8Array`s, or a single `Buffer` or
11481124
`Uint8Array` containing the supported ALPN protocols. `Buffer`s should have
11491125
the format `[len][name][len][name]...` e.g. `0x05hello0x05world`, where the
11501126
first byte is the length of the next protocol name. Passing an array is
11511127
usually much simpler, e.g. `['hello', 'world']`.
11521128
(Protocols should be ordered by their priority.)
1153-
When the server receives both NPN and ALPN extensions from the client,
1154-
ALPN takes precedence over NPN and the server does not send an NPN
1155-
extension to the client.
11561129
* `SNICallback(servername, cb)` {Function} A function that will be called if
11571130
the client supports SNI TLS extension. Two arguments will be passed when
11581131
called: `servername` and `cb`. `SNICallback` should invoke `cb(null, ctx)`,
@@ -1333,7 +1306,6 @@ changes:
13331306
* `server` {net.Server} An optional [`net.Server`][] instance
13341307
* `requestCert`: Optional, see [`tls.createServer()`][]
13351308
* `rejectUnauthorized`: Optional, see [`tls.createServer()`][]
1336-
* `NPNProtocols`: Optional, see [`tls.createServer()`][]
13371309
* `ALPNProtocols`: Optional, see [`tls.createServer()`][]
13381310
* `SNICallback`: Optional, see [`tls.createServer()`][]
13391311
* `session` {Buffer} An optional `Buffer` instance containing a TLS session.

Diff for: lib/_stream_writable.js

+4
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ const { getHighWaterMark } = require('internal/streams/state');
3737
const {
3838
ERR_INVALID_ARG_TYPE,
3939
ERR_METHOD_NOT_IMPLEMENTED,
40+
ERR_MULTIPLE_CALLBACK,
4041
ERR_STREAM_CANNOT_PIPE,
4142
ERR_STREAM_DESTROYED,
4243
ERR_STREAM_NULL_VALUES,
@@ -449,6 +450,9 @@ function onwrite(stream, er) {
449450
var sync = state.sync;
450451
var cb = state.writecb;
451452

453+
if (typeof cb !== 'function')
454+
throw new ERR_MULTIPLE_CALLBACK();
455+
452456
onwriteStateUpdate(state);
453457

454458
if (er)

0 commit comments

Comments
 (0)