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

Commit 1d6dc6e

Browse files
committed
meta: merge node/master into node-chakracore/master
Merge c589561 as of 2017-12-02 This commit was automatically generated. For any problems, please contact jackhorton Reviewed-By: Taylor Woll <[email protected]>
2 parents 7361055 + c589561 commit 1d6dc6e

Some content is hidden

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

45 files changed

+512
-213
lines changed

Diff for: COLLABORATOR_GUIDE.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
- [How is an LTS release cut?](#how-is-an-lts-release-cut)
3434

3535
This document contains information for Collaborators of the Node.js
36-
project regarding maintaining the code, documentation and issues.
36+
project regarding maintaining the code, documentation, and issues.
3737

3838
Collaborators should be familiar with the guidelines for new
3939
contributors in [CONTRIBUTING.md](./CONTRIBUTING.md) and also

Diff for: CONTRIBUTING.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ for any individual to *act* in such a manner that is not in violation of the
7474
strict letter of the Code of Conduct guidelines while still going completely
7575
against the spirit of what that Code is intended to accomplish.
7676

77-
Open, diverse and inclusive communities live and die on the basis of trust.
77+
Open, diverse, and inclusive communities live and die on the basis of trust.
7878
Contributors can disagree with one another so long as they trust that those
7979
disagreements are in good faith and everyone is working towards a common goal.
8080

@@ -177,7 +177,7 @@ Node.js changed that broke the module.
177177
Once an issue has been opened, it is not uncommon for there to be discussion
178178
around it. Some contributors may have differing opinions about the issue,
179179
including whether the behavior being seen is a bug or a feature. This discussion
180-
is part of the process and should be kept focused, helpful and professional.
180+
is part of the process and should be kept focused, helpful, and professional.
181181

182182
Short, clipped responses—that provide neither additional context nor supporting
183183
detail—are not helpful or professional. To many, such responses are simply

Diff for: CPP_STYLE_GUIDE.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* [4 spaces of indentation for statement continuations](#4-spaces-of-indentation-for-statement-continuations)
88
* [Align function arguments vertically](#align-function-arguments-vertically)
99
* [Initialization lists](#initialization-lists)
10-
* [CamelCase for methods, functions and classes](#camelcase-for-methods-functions-and-classes)
10+
* [CamelCase for methods, functions, and classes](#camelcase-for-methods-functions-and-classes)
1111
* [snake\_case for local variables and parameters](#snake_case-for-local-variables-and-parameters)
1212
* [snake\_case\_ for private class fields](#snake_case_-for-private-class-fields)
1313
* [Space after `template`](#space-after-template)
@@ -87,7 +87,7 @@ HandleWrap::HandleWrap(Environment* env,
8787
handle_(handle) {
8888
```
8989
90-
## CamelCase for methods, functions and classes
90+
## CamelCase for methods, functions, and classes
9191
9292
Exceptions are simple getters/setters, which are named `property_name()` and
9393
`set_property_name()`, respectively.

Diff for: doc/STYLE_GUIDE.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
human reviewers.
1515
* American English spelling is preferred. "Capitalize" vs. "Capitalise",
1616
"color" vs. "colour", etc.
17-
* Though controversial, the [Oxford comma][] is preferred for clarity's sake.
17+
* Use [serial commas][].
1818
* Generally avoid personal pronouns in reference documentation ("I", "you",
1919
"we").
2020
* Pronouns are acceptable in more colloquial documentation, like guides.
@@ -75,6 +75,6 @@
7575

7676
[Em dashes]: https://en.wikipedia.org/wiki/Dash#Em_dash
7777
[Javascript type]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Grammar_and_types#Data_structures_and_types
78-
[Oxford comma]: https://en.wikipedia.org/wiki/Serial_comma
78+
[serial commas]: https://en.wikipedia.org/wiki/Serial_comma
7979
[The New York Times Manual of Style and Usage]: https://en.wikipedia.org/wiki/The_New_York_Times_Manual_of_Style_and_Usage
8080
[plugin]: http://editorconfig.org/#download

Diff for: doc/api/addons.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ involving knowledge of several components and APIs :
2020
threads and all of the asynchronous behaviors of the platform. It also
2121
serves as a cross-platform abstraction library, giving easy, POSIX-like
2222
access across all major operating systems to many common system tasks, such
23-
as interacting with the filesystem, sockets, timers and system events. libuv
23+
as interacting with the filesystem, sockets, timers, and system events. libuv
2424
also provides a pthreads-like threading abstraction that may be used to
2525
power more sophisticated asynchronous Addons that need to move beyond the
2626
standard event loop. Addon authors are encouraged to think about how to

Diff for: doc/api/buffer.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ changes:
154154
-->
155155

156156
`Buffer` instances are commonly used to represent sequences of encoded characters
157-
such as UTF-8, UCS2, Base64 or even Hex-encoded data. It is possible to
157+
such as UTF-8, UCS2, Base64, or even Hex-encoded data. It is possible to
158158
convert back and forth between `Buffer` instances and ordinary JavaScript strings
159159
by using an explicit character encoding.
160160

Diff for: doc/api/child_process.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -628,7 +628,7 @@ pipes between the parent and child. The value is one of the following:
628628
5. Positive integer - The integer value is interpreted as a file descriptor
629629
that is is currently open in the parent process. It is shared with the child
630630
process, similar to how {Stream} objects can be shared.
631-
6. `null`, `undefined` - Use default value. For stdio fds 0, 1 and 2 (in other
631+
6. `null`, `undefined` - Use default value. For stdio fds 0, 1, and 2 (in other
632632
words, stdin, stdout, and stderr) a pipe is created. For fd 3 and up, the
633633
default is `'ignore'`.
634634

Diff for: doc/api/crypto.md

+14-4
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
> Stability: 2 - Stable
66
77
The `crypto` module provides cryptographic functionality that includes a set of
8-
wrappers for OpenSSL's hash, HMAC, cipher, decipher, sign and verify functions.
8+
wrappers for OpenSSL's hash, HMAC, cipher, decipher, sign, and verify functions.
99

1010
Use `require('crypto')` to access this module.
1111

@@ -651,7 +651,11 @@ added: v0.11.14
651651
changes:
652652
- version: v6.0.0
653653
pr-url: https://github.com/nodejs/node/pull/5522
654-
description: The default `inputEncoding` changed from `binary` to `utf8`.
654+
description: The default `inputEncoding` changed from `binary` to `utf8`
655+
- version: REPLACEME
656+
pr-url: https://github.com/nodejs/node/pull/16849
657+
description: Changed error format to better support invalid public key
658+
error
655659
-->
656660
- `otherPublicKey` {string | Buffer | TypedArray | DataView}
657661
- `inputEncoding` {string}
@@ -668,6 +672,12 @@ provided, `otherPublicKey` is expected to be a [`Buffer`][], `TypedArray`, or
668672
If `outputEncoding` is given a string will be returned; otherwise a
669673
[`Buffer`][] is returned.
670674

675+
`ecdh.computeSecret` will throw an
676+
`ERR_CRYPTO_ECDH_INVALID_PUBLIC_KEY` error when `otherPublicKey`
677+
lies outside of the elliptic curve. Since `otherPublicKey` is
678+
usually supplied from a remote user over an insecure network,
679+
its recommended for developers to handle this exception accordingly.
680+
671681
### ecdh.generateKeys([encoding[, format]])
672682
<!-- YAML
673683
added: v0.11.14
@@ -1254,7 +1264,7 @@ In line with OpenSSL's recommendation to use pbkdf2 instead of
12541264
[`EVP_BytesToKey`][] it is recommended that developers derive a key and IV on
12551265
their own using [`crypto.pbkdf2()`][] and to use [`crypto.createCipheriv()`][]
12561266
to create the `Cipher` object. Users should not use ciphers with counter mode
1257-
(e.g. CTR, GCM or CCM) in `crypto.createCipher()`. A warning is emitted when
1267+
(e.g. CTR, GCM, or CCM) in `crypto.createCipher()`. A warning is emitted when
12581268
they are used in order to avoid the risk of IV reuse that causes
12591269
vulnerabilities. For the case when IV is reused in GCM, see [Nonce-Disrespecting
12601270
Adversaries][] for details.
@@ -2034,7 +2044,7 @@ Based on the recommendations of [NIST SP 800-131A][]:
20342044

20352045
- MD5 and SHA-1 are no longer acceptable where collision resistance is
20362046
required such as digital signatures.
2037-
- The key used with RSA, DSA and DH algorithms is recommended to have
2047+
- The key used with RSA, DSA, and DH algorithms is recommended to have
20382048
at least 2048 bits and that of the curve of ECDSA and ECDH at least
20392049
224 bits, to be safe to use for several years.
20402050
- The DH groups of `modp1`, `modp2` and `modp5` have a key size

Diff for: doc/api/errors.md

+7
Original file line numberDiff line numberDiff line change
@@ -676,6 +676,13 @@ of OpenSSL being used.
676676
An invalid value for the `format` argument was passed to the `crypto.ECDH()`
677677
class `getPublicKey()` method.
678678

679+
<a id="ERR_CRYPTO_ECDH_INVALID_PUBLIC_KEY"></a>
680+
### ERR_CRYPTO_ECDH_INVALID_PUBLIC_KEY
681+
682+
An invalid value for the `key` argument has been passed to the
683+
`crypto.ECDH()` class `computeSecret()` method. It means that the public
684+
key lies outside of the elliptic curve.
685+
679686
<a id="ERR_CRYPTO_ENGINE_UNKNOWN"></a>
680687
### ERR_CRYPTO_ENGINE_UNKNOWN
681688

Diff for: doc/api/fs.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -1881,7 +1881,7 @@ Linux, and Windows, an error will be returned. On FreeBSD, a representation
18811881
of the directory's contents will be returned.
18821882

18831883
```js
1884-
// macOS, Linux and Windows
1884+
// macOS, Linux, and Windows
18851885
fs.readFile('<directory>', (err, data) => {
18861886
// => [Error: EISDIR: illegal operation on a directory, read <directory>]
18871887
});
@@ -1929,7 +1929,7 @@ string. Otherwise it returns a buffer.
19291929
behavior of `fs.readFileSync()` is platform-specific.
19301930

19311931
```js
1932-
// macOS, Linux and Windows
1932+
// macOS, Linux, and Windows
19331933
fs.readFileSync('<directory>');
19341934
// => [Error: EISDIR: illegal operation on a directory, read <directory>]
19351935

@@ -3043,7 +3043,7 @@ The following constants are meant for use with the [`fs.Stats`][] object's
30433043
</tr>
30443044
<tr>
30453045
<td><code>S_IRWXU</code></td>
3046-
<td>File mode indicating readable, writable and executable by owner.</td>
3046+
<td>File mode indicating readable, writable, and executable by owner.</td>
30473047
</tr>
30483048
<tr>
30493049
<td><code>S_IRUSR</code></td>
@@ -3059,7 +3059,7 @@ The following constants are meant for use with the [`fs.Stats`][] object's
30593059
</tr>
30603060
<tr>
30613061
<td><code>S_IRWXG</code></td>
3062-
<td>File mode indicating readable, writable and executable by group.</td>
3062+
<td>File mode indicating readable, writable, and executable by group.</td>
30633063
</tr>
30643064
<tr>
30653065
<td><code>S_IRGRP</code></td>
@@ -3075,7 +3075,7 @@ The following constants are meant for use with the [`fs.Stats`][] object's
30753075
</tr>
30763076
<tr>
30773077
<td><code>S_IRWXO</code></td>
3078-
<td>File mode indicating readable, writable and executable by others.</td>
3078+
<td>File mode indicating readable, writable, and executable by others.</td>
30793079
</tr>
30803080
<tr>
30813081
<td><code>S_IROTH</code></td>

Diff for: doc/api/http2.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -1264,7 +1264,7 @@ added: v8.4.0
12641264

12651265
In `Http2Server`, there is no `'clientError'` event as there is in
12661266
HTTP1. However, there are `'socketError'`, `'sessionError'`, and
1267-
`'streamError'`, for error happened on the socket, session or stream
1267+
`'streamError'`, for error happened on the socket, session, or stream
12681268
respectively.
12691269

12701270
#### Event: 'socketError'
@@ -1857,7 +1857,7 @@ performance.
18571857
There are several types of error conditions that may arise when using the
18581858
`http2` module:
18591859

1860-
Validation Errors occur when an incorrect argument, option or setting value is
1860+
Validation Errors occur when an incorrect argument, option, or setting value is
18611861
passed in. These will always be reported by a synchronous `throw`.
18621862

18631863
State Errors occur when an action is attempted at an incorrect time (for
@@ -2229,7 +2229,7 @@ added: v8.4.0
22292229
* {net.Socket|tls.TLSSocket}
22302230

22312231
Returns a Proxy object that acts as a `net.Socket` (or `tls.TLSSocket`) but
2232-
applies getters, setters and methods based on HTTP/2 logic.
2232+
applies getters, setters, and methods based on HTTP/2 logic.
22332233

22342234
`destroyed`, `readable`, and `writable` properties will be retrieved from and
22352235
set on `request.stream`.
@@ -2601,7 +2601,7 @@ added: v8.4.0
26012601
* {net.Socket|tls.TLSSocket}
26022602

26032603
Returns a Proxy object that acts as a `net.Socket` (or `tls.TLSSocket`) but
2604-
applies getters, setters and methods based on HTTP/2 logic.
2604+
applies getters, setters, and methods based on HTTP/2 logic.
26052605

26062606
`destroyed`, `readable`, and `writable` properties will be retrieved from and
26072607
set on `response.stream`.

Diff for: doc/api/n-api.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -2257,7 +2257,7 @@ following forms:
22572257
- Named: a simple UTF8-encoded string
22582258
- Integer-Indexed: an index value represented by `uint32_t`
22592259
- JavaScript value: these are represented in N-API by `napi_value`. This can
2260-
be a `napi_value` representing a String, Number or Symbol.
2260+
be a `napi_value` representing a String, Number, or Symbol.
22612261

22622262
N-API values are represented by the type `napi_value`.
22632263
Any N-API call that requires a JavaScript value takes in a `napi_value`.
@@ -3471,8 +3471,8 @@ napi_status napi_get_node_version(napi_env env,
34713471

34723472
Returns `napi_ok` if the API succeeded.
34733473

3474-
This function fills the `version` struct with the major, minor and patch version
3475-
of Node that is currently running, and the `release` field with the
3474+
This function fills the `version` struct with the major, minor, and patch
3475+
version of Node.js that is currently running, and the `release` field with the
34763476
value of [`process.release.name`][`process.release`].
34773477

34783478
The returned buffer is statically allocated and does not need to be freed.

Diff for: doc/api/os.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,7 @@ The following signal constants are exported by `os.constants.signals`:
453453
<tr>
454454
<td><code>SIGILL</code></td>
455455
<td>Sent to a process to notify that it has attempted to perform an illegal,
456-
malformed, unknown or privileged instruction.</td>
456+
malformed, unknown, or privileged instruction.</td>
457457
</tr>
458458
<tr>
459459
<td><code>SIGTRAP</code></td>

Diff for: doc/api/process.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ A process warning is similar to an error in that it describes exceptional
275275
conditions that are being brought to the user's attention. However, warnings
276276
are not part of the normal Node.js and JavaScript error handling flow.
277277
Node.js can emit warnings whenever it detects bad coding practices that could
278-
lead to sub-optimal application performance, bugs or security vulnerabilities.
278+
lead to sub-optimal application performance, bugs, or security vulnerabilities.
279279

280280
The listener function is called with a single `warning` argument whose value is
281281
an `Error` object. There are three key properties that describe the warning:
@@ -1307,7 +1307,7 @@ objects managed by V8. `rss`, Resident Set Size, is the amount of space
13071307
occupied in the main memory device (that is a subset of the total allocated
13081308
memory) for the process, which includes the _heap_, _code segment_ and _stack_.
13091309

1310-
The _heap_ is where objects, strings and closures are stored. Variables are
1310+
The _heap_ is where objects, strings, and closures are stored. Variables are
13111311
stored in the _stack_ and the actual JavaScript code resides in the
13121312
_code segment_.
13131313

Diff for: doc/api/tls.md

+55-4
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ 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, NPN, and SNI
108108

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

@@ -742,6 +742,55 @@ and their processing can be delayed due to packet loss or reordering. However,
742742
smaller fragments add extra TLS framing bytes and CPU overhead, which may
743743
decrease overall server throughput.
744744

745+
## tls.checkServerIdentity(host, cert)
746+
<!-- YAML
747+
added: v0.8.4
748+
-->
749+
750+
* `host` {string} The hostname to verify the certificate against
751+
* `cert` {Object} An object representing the peer's certificate. The returned
752+
object has some properties corresponding to the fields of the certificate.
753+
754+
Verifies the certificate `cert` is issued to host `host`.
755+
756+
Returns {Error} object, populating it with the reason, host and cert on failure.
757+
On success, returns {undefined}.
758+
759+
*Note*: This function can be overwritten by providing alternative function
760+
as part of the `options.checkServerIdentity` option passed to `tls.connect()`.
761+
The overwriting function can call `tls.checkServerIdentity()` of course, to augment
762+
the checks done with additional verification.
763+
764+
*Note*: This function is only called if the certificate passed all other checks, such as
765+
being issued by trusted CA (`options.ca`).
766+
767+
The cert object contains the parsed certificate and will have a structure similar to:
768+
769+
```text
770+
{ subject:
771+
{ OU: [ 'Domain Control Validated', 'PositiveSSL Wildcard' ],
772+
CN: '*.nodejs.org' },
773+
issuer:
774+
{ C: 'GB',
775+
ST: 'Greater Manchester',
776+
L: 'Salford',
777+
O: 'COMODO CA Limited',
778+
CN: 'COMODO RSA Domain Validation Secure Server CA' },
779+
subjectaltname: 'DNS:*.nodejs.org, DNS:nodejs.org',
780+
infoAccess:
781+
{ 'CA Issuers - URI':
782+
[ 'http://crt.comodoca.com/COMODORSADomainValidationSecureServerCA.crt' ],
783+
'OCSP - URI': [ 'http://ocsp.comodoca.com' ] },
784+
modulus: 'B56CE45CB740B09A13F64AC543B712FF9EE8E4C284B542A1708A27E82A8D151CA178153E12E6DDA15BF70FFD96CB8A88618641BDFCCA03527E665B70D779C8A349A6F88FD4EF6557180BD4C98192872BCFE3AF56E863C09DDD8BC1EC58DF9D94F914F0369102B2870BECFA1348A0838C9C49BD1C20124B442477572347047506B1FCD658A80D0C44BCC16BC5C5496CFE6E4A8428EF654CD3D8972BF6E5BFAD59C93006830B5EB1056BBB38B53D1464FA6E02BFDF2FF66CD949486F0775EC43034EC2602AEFBF1703AD221DAA2A88353C3B6A688EFE8387811F645CEED7B3FE46E1F8B9F59FAD028F349B9BC14211D5830994D055EEA3D547911E07A0ADDEB8A82B9188E58720D95CD478EEC9AF1F17BE8141BE80906F1A339445A7EB5B285F68039B0F294598A7D1C0005FC22B5271B0752F58CCDEF8C8FD856FB7AE21C80B8A2CE983AE94046E53EDE4CB89F42502D31B5360771C01C80155918637490550E3F555E2EE75CC8C636DDE3633CFEDD62E91BF0F7688273694EEEBA20C2FC9F14A2A435517BC1D7373922463409AB603295CEB0BB53787A334C9CA3CA8B30005C5A62FC0715083462E00719A8FA3ED0A9828C3871360A73F8B04A4FC1E71302844E9BB9940B77E745C9D91F226D71AFCAD4B113AAF68D92B24DDB4A2136B55A1CD1ADF39605B63CB639038ED0F4C987689866743A68769CC55847E4A06D6E2E3F1',
785+
exponent: '0x10001',
786+
valid_from: 'Aug 14 00:00:00 2017 GMT',
787+
valid_to: 'Nov 20 23:59:59 2019 GMT',
788+
fingerprint: '01:02:59:D9:C3:D2:0D:08:F7:82:4E:44:A4:B4:53:C5:E2:3A:87:4D',
789+
ext_key_usage: [ '1.3.6.1.5.5.7.3.1', '1.3.6.1.5.5.7.3.2' ],
790+
serialNumber: '66593D57F20CBC573E433381B5FEC280',
791+
raw: <Buffer ....> }
792+
```
793+
745794
## tls.connect(options[, callback])
746795
<!-- YAML
747796
added: v0.11.3
@@ -792,9 +841,11 @@ changes:
792841
* `servername`: {string} Server name for the SNI (Server Name Indication) TLS
793842
extension.
794843
* `checkServerIdentity(servername, cert)` {Function} A callback function
795-
to be used when checking the server's hostname against the certificate.
796-
This should throw an error if verification fails. The method should return
797-
`undefined` if the `servername` and `cert` are verified.
844+
   to be used (instead of the builtin `tls.checkServerIdentity()` function)
845+
when checking the server's hostname (or the provided `servername` when
846+
explicitly set) against the certificate. This should return an {Error} if
847+
verification fails. The method should return `undefined` if the `servername`
848+
and `cert` are verified.
798849
* `session` {Buffer} A `Buffer` instance, containing TLS session.
799850
* `minDHSize` {number} Minimum size of the DH parameter in bits to accept a
800851
TLS connection. When a server offers a DH parameter with a size less

Diff for: doc/api/util.md

+18
Original file line numberDiff line numberDiff line change
@@ -350,6 +350,24 @@ changes:
350350
The `util.inspect()` method returns a string representation of `object` that is
351351
primarily useful for debugging. Additional `options` may be passed that alter
352352
certain aspects of the formatted string.
353+
`util.inspect()` will use the constructor's name and/or `@@toStringTag` to make an
354+
identifiable tag for an inspected value.
355+
356+
```js
357+
class Foo {
358+
get [Symbol.toStringTag]() {
359+
return 'bar';
360+
}
361+
}
362+
363+
class Bar {}
364+
365+
const baz = Object.create(null, { [Symbol.toStringTag]: { value: 'foo' } });
366+
367+
util.inspect(new Foo()); // 'Foo [bar] {}'
368+
util.inspect(new Bar()); // 'Bar {}'
369+
util.inspect(baz); // '[foo] {}'
370+
```
353371

354372
The following example inspects all properties of the `util` object:
355373

0 commit comments

Comments
 (0)