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

Commit 4fc16fc

Browse files
committed
Merge nodejs/master
Merge d2e44d5 as of 2017-10-25. This is an automatically created merge. For any problems please contact @kunalspathak.
2 parents eaf6763 + d2e44d5 commit 4fc16fc

Some content is hidden

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

47 files changed

+807
-168
lines changed

CHANGELOG.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ release.
2727
</tr>
2828
<tr>
2929
<td valign="top">
30-
<b><a href="doc/changelogs/CHANGELOG_V8.md#8.7.0">8.7.0</a></b><br/>
30+
<b><a href="doc/changelogs/CHANGELOG_V8.md#8.8.0">8.8.0</a></b><br/>
31+
<a href="doc/changelogs/CHANGELOG_V8.md#8.7.0">8.7.0</a><br/>
3132
<a href="doc/changelogs/CHANGELOG_V8.md#8.6.0">8.6.0</a><br/>
3233
<a href="doc/changelogs/CHANGELOG_V8.md#8.5.0">8.5.0</a><br/>
3334
<a href="doc/changelogs/CHANGELOG_V8.md#8.4.0">8.4.0</a><br/>
@@ -61,7 +62,8 @@ release.
6162
<a href="doc/changelogs/CHANGELOG_V7.md#7.0.0">7.0.0</a><br/>
6263
</td>
6364
<td valign="top">
64-
<b><a href="doc/changelogs/CHANGELOG_V6.md#6.11.4">6.11.4</a></b><br/>
65+
<b><a href="doc/changelogs/CHANGELOG_V6.md#6.11.5">6.11.5</a></b><br/>
66+
<a href="doc/changelogs/CHANGELOG_V6.md#6.11.4">6.11.4</a><br/>
6567
<a href="doc/changelogs/CHANGELOG_V6.md#6.11.3">6.11.3</a><br/>
6668
<a href="doc/changelogs/CHANGELOG_V6.md#6.11.2">6.11.2</a><br/>
6769
<a href="doc/changelogs/CHANGELOG_V6.md#6.11.1">6.11.1</a><br/>
@@ -91,7 +93,8 @@ release.
9193
<a href="doc/changelogs/CHANGELOG_V6.md#6.0.0">6.0.0</a><br/>
9294
</td>
9395
<td valign="top">
94-
<b><a href="doc/changelogs/CHANGELOG_V4.md#4.8.4">4.8.4</a></b><br/>
96+
<b><a href="doc/changelogs/CHANGELOG_V4.md#4.8.5">4.8.5</a></b><br/>
97+
<a href="doc/changelogs/CHANGELOG_V4.md#4.8.4">4.8.4</a><br/>
9598
<a href="doc/changelogs/CHANGELOG_V4.md#4.8.3">4.8.3</a><br/>
9699
<a href="doc/changelogs/CHANGELOG_V4.md#4.8.2">4.8.2</a><br/>
97100
<a href="doc/changelogs/CHANGELOG_V4.md#4.8.1">4.8.1</a><br/>

COLLABORATOR_GUIDE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -677,4 +677,4 @@ LTS working group and the Release team.
677677
[backporting guide]: doc/guides/backporting-to-release-lines.md
678678
[Stability Index]: doc/api/documentation.md#stability-index
679679
[Enhancement Proposal]: https://github.com/nodejs/node-eps
680-
[git-username]: https://help.github.com/articles/setting-your-username-in-git/
680+
[git-username]: https://help.github.com/articles/setting-your-username-in-git/

common.gypi

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@
164164
'BasicRuntimeChecks': 3, # /RTC1
165165
'AdditionalOptions': [
166166
'/bigobj', # prevent error C1128 in VS2015
167+
'/MP', # compile across multiple CPUs
167168
],
168169
},
169170
'VCLinkerTool': {
@@ -222,6 +223,9 @@
222223
'EnableFunctionLevelLinking': 'true',
223224
'EnableIntrinsicFunctions': 'true',
224225
'RuntimeTypeInfo': 'false',
226+
'AdditionalOptions': [
227+
'/MP', # compile across multiple CPUs
228+
],
225229
},
226230
'VCLibrarianTool': {
227231
'AdditionalOptions': [
@@ -254,9 +258,6 @@
254258
# and their sheer number drowns out other, more legitimate warnings.
255259
'DisableSpecificWarnings': ['4267'],
256260
'WarnAsError': 'false',
257-
'AdditionalOptions': [
258-
'/MP', # compile across multiple CPUs
259-
],
260261
},
261262
'VCLibrarianTool': {
262263
},

doc/api/child_process.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ exec('"my script.cmd" a b', (err, stdout, stderr) => {
128128
<!-- YAML
129129
added: v0.1.90
130130
changes:
131-
- version: REPLACEME
131+
- version: v8.8.0
132132
pr-url: https://github.com/nodejs/node/pull/15380
133133
description: The `windowsHide` option is supported now.
134134
-->
@@ -244,7 +244,7 @@ lsExample();
244244
<!-- YAML
245245
added: v0.1.91
246246
changes:
247-
- version: REPLACEME
247+
- version: v8.8.0
248248
pr-url: https://github.com/nodejs/node/pull/15380
249249
description: The `windowsHide` option is supported now.
250250
-->
@@ -375,7 +375,7 @@ supported by `child_process.fork()` and will be ignored if set.
375375
<!-- YAML
376376
added: v0.1.90
377377
changes:
378-
- version: REPLACEME
378+
- version: v8.8.0
379379
pr-url: https://github.com/nodejs/node/pull/15380
380380
description: The `windowsHide` option is supported now.
381381
- version: v6.4.0
@@ -665,7 +665,7 @@ configuration at startup.
665665
<!-- YAML
666666
added: v0.11.12
667667
changes:
668-
- version: REPLACEME
668+
- version: v8.8.0
669669
pr-url: https://github.com/nodejs/node/pull/15380
670670
description: The `windowsHide` option is supported now.
671671
- version: v8.0.0
@@ -719,7 +719,7 @@ throw an [`Error`][] that will include the full result of the underlying
719719
<!-- YAML
720720
added: v0.11.12
721721
changes:
722-
- version: REPLACEME
722+
- version: v8.8.0
723723
pr-url: https://github.com/nodejs/node/pull/15380
724724
description: The `windowsHide` option is supported now.
725725
- version: v8.0.0
@@ -775,7 +775,7 @@ execution.
775775
<!-- YAML
776776
added: v0.11.12
777777
changes:
778-
- version: REPLACEME
778+
- version: v8.8.0
779779
pr-url: https://github.com/nodejs/node/pull/15380
780780
description: The `windowsHide` option is supported now.
781781
- version: v8.0.0

doc/api/domain.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
# Domain
22
<!-- YAML
33
changes:
4-
- version: REPLACEME
5-
pr-url: https://github.com/nodejs/node/pull/REPLACEME
4+
- version: v8.8.0
65
description: Any `Promise`s created in VM contexts no longer have a
76
`.domain` property. Their handlers are still executed in the
87
proper domain, however, and `Promise`s created in the main

doc/api/errors.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -810,8 +810,8 @@ reached.
810810
<a id="ERR_HTTP2_NO_SOCKET_MANIPULATION"></a>
811811
### ERR_HTTP2_NO_SOCKET_MANIPULATION
812812

813-
Used when attempting to read, write, pause, and/or resume a socket attached to
814-
an `Http2Session`.
813+
Used when attempting to directly manipulate (e.g read, write, pause, resume,
814+
etc.) a socket attached to an `Http2Session`.
815815

816816
<a id="ERR_HTTP2_OUT_OF_STREAMS"></a>
817817
### ERR_HTTP2_OUT_OF_STREAMS

doc/api/esm.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ points into ESM graphs at run time.
4343
| `require('./foo.mjs')` | ES Modules have differing resolution and timing, use language standard `import()` |
4444
| `import()` | pending newer V8 release used in Node.js |
4545
| `import.meta` | pending V8 implementation |
46-
| Loader Hooks | pending Node.js EP creation/consensus |
4746

4847
## Notable differences between `import` and `require`
4948

doc/api/http2.md

Lines changed: 54 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,25 @@ support for HTTP/2 protocol features. It is specifically *not* designed for
1616
compatibility with the existing [HTTP/1][] module API. However,
1717
the [Compatibility API][] is.
1818

19+
The `http2` Core API is much more symmetric between client and server than the
20+
`http` API. For instance, most events, like `error` and `socketError`, can be
21+
emitted either by client-side code or server-side code.
22+
23+
### Server-side example
24+
1925
The following illustrates a simple, plain-text HTTP/2 server using the
2026
Core API:
2127

2228
```js
2329
const http2 = require('http2');
30+
const fs = require('fs');
2431

25-
// Create a plain-text HTTP/2 server
26-
const server = http2.createServer();
32+
const server = http2.createSecureServer({
33+
key: fs.readFileSync('localhost-privkey.pem'),
34+
cert: fs.readFileSync('localhost-cert.pem')
35+
});
36+
server.on('error', (err) => console.error(err));
37+
server.on('socketError', (err) => console.error(err));
2738

2839
server.on('stream', (stream, headers) => {
2940
// stream is a Duplex
@@ -34,34 +45,44 @@ server.on('stream', (stream, headers) => {
3445
stream.end('<h1>Hello World</h1>');
3546
});
3647

37-
server.listen(80);
48+
server.listen(8443);
3849
```
3950

40-
Note that the above example is an HTTP/2 server that does not support SSL.
41-
This is significant as most browsers support HTTP/2 only with SSL.
42-
To make the above server be able to serve content to browsers,
43-
replace `http2.createServer()` with
44-
`http2.createSecureServer({key: /* your SSL key */, cert: /* your SSL cert */})`.
51+
To generate the certificate and key for this example, run:
52+
53+
```bash
54+
openssl req -x509 -newkey rsa:2048 -nodes -sha256 -subj '/CN=localhost' \
55+
-keyout localhost-privkey.pem -out localhost-cert.pem
56+
```
57+
58+
### Client-side example
4559

4660
The following illustrates an HTTP/2 client:
4761

4862
```js
4963
const http2 = require('http2');
64+
const fs = require('fs');
65+
const client = http2.connect('https://localhost:8443', {
66+
ca: fs.readFileSync('localhost-cert.pem')
67+
});
68+
client.on('socketError', (err) => console.error(err));
69+
client.on('error', (err) => console.error(err));
5070

51-
const client = http2.connect('http://localhost:80');
52-
53-
// req is a Duplex
5471
const req = client.request({ ':path': '/' });
5572

56-
req.on('response', (headers) => {
57-
console.log(headers[':status']);
58-
console.log(headers['date']);
73+
req.on('response', (headers, flags) => {
74+
for (const name in headers) {
75+
console.log(`${name}: ${headers[name]}`);
76+
}
5977
});
6078

61-
let data = '';
6279
req.setEncoding('utf8');
63-
req.on('data', (d) => data += d);
64-
req.on('end', () => client.destroy());
80+
let data = '';
81+
req.on('data', (chunk) => { data += chunk; });
82+
req.on('end', () => {
83+
console.log(`\n${data}`);
84+
client.destroy();
85+
});
6586
req.end();
6687
```
6788

@@ -463,12 +484,16 @@ added: v8.4.0
463484

464485
* Value: {net.Socket|tls.TLSSocket}
465486

466-
A reference to the [`net.Socket`][] or [`tls.TLSSocket`][] to which this
467-
`Http2Session` instance is bound.
487+
Returns a Proxy object that acts as a `net.Socket` (or `tls.TLSSocket`) but
488+
limits available methods to ones safe to use with HTTP/2.
468489

469-
*Note*: It is not recommended for user code to interact directly with a
470-
`Socket` bound to an `Http2Session`. See [Http2Session and Sockets][] for
471-
details.
490+
`destroy`, `emit`, `end`, `pause`, `read`, `resume`, and `write` will throw
491+
an error with code `ERR_HTTP2_NO_SOCKET_MANIPULATION`. See
492+
[Http2Session and Sockets][] for more information.
493+
494+
`setTimeout` method will be called on this `Http2Session`.
495+
496+
All other interactions will be routed directly to the socket.
472497

473498
#### http2session.state
474499
<!-- YAML
@@ -2138,10 +2163,10 @@ Returns `request`.
21382163
added: v8.4.0
21392164
-->
21402165

2141-
* {net.Socket}
2166+
* {net.Socket|tls.TLSSocket}
21422167

2143-
Returns a Proxy object that acts as a `net.Socket` but applies getters,
2144-
setters and methods based on HTTP/2 logic.
2168+
Returns a Proxy object that acts as a `net.Socket` (or `tls.TLSSocket`) but
2169+
applies getters, setters and methods based on HTTP/2 logic.
21452170

21462171
`destroyed`, `readable`, and `writable` properties will be retrieved from and
21472172
set on `request.stream`.
@@ -2293,7 +2318,7 @@ will result in a [`TypeError`][] being thrown.
22932318
added: v8.4.0
22942319
-->
22952320

2296-
* {net.Socket}
2321+
* {net.Socket|tls.TLSSocket}
22972322

22982323
See [`response.socket`][].
22992324

@@ -2510,10 +2535,10 @@ Returns `response`.
25102535
added: v8.4.0
25112536
-->
25122537

2513-
* {net.Socket}
2538+
* {net.Socket|tls.TLSSocket}
25142539

2515-
Returns a Proxy object that acts as a `net.Socket` but applies getters,
2516-
setters and methods based on HTTP/2 logic.
2540+
Returns a Proxy object that acts as a `net.Socket` (or `tls.TLSSocket`) but
2541+
applies getters, setters and methods based on HTTP/2 logic.
25172542

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

doc/api/modules.md

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -598,14 +598,36 @@ filename scales linearly with the number of registered extensions.
598598
In other words, adding extensions slows down the module loader and
599599
should be discouraged.
600600

601-
#### require.resolve()
601+
#### require.resolve(request[, options])
602602
<!-- YAML
603603
added: v0.3.0
604+
changes:
605+
- version: REPLACEME
606+
pr-url: https://github.com/nodejs/node/pull/16397
607+
description: The `paths` option is now supported.
604608
-->
605609

610+
* `request` {string} The module path to resolve.
611+
* `options` {Object}
612+
* `paths` {Array} Paths to resolve module location from. If present, these
613+
paths are used instead of the default resolution paths. Note that each of
614+
these paths is used as a starting point for the module resolution algorithm,
615+
meaning that the `node_modules` hierarchy is checked from this location.
616+
* Returns: {string}
617+
606618
Use the internal `require()` machinery to look up the location of a module,
607619
but rather than loading the module, just return the resolved filename.
608620

621+
#### require.resolve.paths(request)
622+
<!-- YAML
623+
added: REPLACEME
624+
-->
625+
626+
* `request` {string} The module path whose lookup paths are being retrieved.
627+
* Returns: {Array}
628+
629+
Returns an array containing the paths searched during resolution of `request`.
630+
609631
## The `module` Object
610632
<!-- YAML
611633
added: v0.1.16

doc/api/process.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1899,7 +1899,7 @@ cases:
18991899
[`promise.catch()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/catch
19001900
[`require()`]: globals.html#globals_require
19011901
[`require.main`]: modules.html#modules_accessing_the_main_module
1902-
[`require.resolve()`]: modules.html#modules_require_resolve
1902+
[`require.resolve()`]: modules.html#modules_require_resolve_request_options
19031903
[`setTimeout(fn, 0)`]: timers.html#timers_settimeout_callback_delay_args
19041904
[Child Process]: child_process.html
19051905
[Cluster]: cluster.html

0 commit comments

Comments
 (0)