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

Commit acc60e6

Browse files
committed
meta: merge node/master into node-chakracore/master
Merge 47a984a as of 2018-02-04 This commit was automatically generated. For any problems, please contact jackhorton Reviewed-By: chakrabot <chakrabot@users.noreply.github.com>
2 parents ff686dc + 47a984a commit acc60e6

32 files changed

+401
-179
lines changed

benchmark/tls/throughput.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,11 @@ function main({ dur, type, size }) {
4040
};
4141

4242
server = tls.createServer(options, onConnection);
43-
setTimeout(done, dur * 1000);
4443
var conn;
4544
server.listen(common.PORT, function() {
4645
const opt = { port: common.PORT, rejectUnauthorized: false };
4746
conn = tls.connect(opt, function() {
47+
setTimeout(done, dur * 1000);
4848
bench.start();
4949
conn.on('drain', write);
5050
write();

configure

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ parser = optparse.OptionParser()
6161
valid_os = ('win', 'mac', 'solaris', 'freebsd', 'openbsd', 'linux',
6262
'android', 'aix', 'cloudabi')
6363
valid_arch = ('arm', 'arm64', 'ia32', 'mips', 'mipsel', 'mips64el', 'ppc',
64-
'ppc64', 'x32','x64', 'x86', 's390', 's390x')
64+
'ppc64', 'x32','x64', 'x86', 'x86_64', 's390', 's390x')
6565
valid_arm_float_abi = ('soft', 'softfp', 'hard')
6666
valid_arm_fpu = ('vfp', 'vfpv3', 'vfpv3-d16', 'neon')
6767
valid_mips_arch = ('loongson', 'r1', 'r2', 'r6', 'rx')
@@ -891,6 +891,9 @@ def configure_node(o):
891891
# the Makefile resets this to x86 afterward
892892
if target_arch == 'x86':
893893
target_arch = 'ia32'
894+
# x86_64 is common across linuxes, allow it as an alias for x64
895+
if target_arch == 'x86_64':
896+
target_arch = 'x64'
894897
o['variables']['host_arch'] = host_arch
895898
o['variables']['target_arch'] = target_arch
896899
o['variables']['node_byteorder'] = sys.byteorder

doc/api/child_process.md

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ implemented on top of [`child_process.spawn()`][] or [`child_process.spawnSync()
4444
* [`child_process.exec()`][]: spawns a shell and runs a command within that shell,
4545
passing the `stdout` and `stderr` to a callback function when complete.
4646
* [`child_process.execFile()`][]: similar to [`child_process.exec()`][] except that
47-
it spawns the command directly without first spawning a shell.
47+
it spawns the command directly without first spawning a shell by default.
4848
* [`child_process.fork()`][]: spawns a new Node.js process and invokes a
4949
specified module with an IPC communication channel established that allows
5050
sending messages between parent and child.
@@ -78,7 +78,7 @@ when the child process terminates.
7878
The importance of the distinction between [`child_process.exec()`][] and
7979
[`child_process.execFile()`][] can vary based on platform. On Unix-type operating
8080
systems (Unix, Linux, macOS) [`child_process.execFile()`][] can be more efficient
81-
because it does not spawn a shell. On Windows, however, `.bat` and `.cmd`
81+
because it does not spawn a shell by default. On Windows, however, `.bat` and `.cmd`
8282
files are not executable on their own without a terminal, and therefore cannot
8383
be launched using [`child_process.execFile()`][]. When running on Windows, `.bat`
8484
and `.cmd` files can be invoked using [`child_process.spawn()`][] with the `shell`
@@ -266,14 +266,18 @@ changes:
266266
normally be created on Windows systems. **Default:** `false`.
267267
* `windowsVerbatimArguments` {boolean} No quoting or escaping of arguments is
268268
done on Windows. Ignored on Unix. **Default:** `false`.
269+
* `shell` {boolean|string} If `true`, runs `command` inside of a shell. Uses
270+
`'/bin/sh'` on UNIX, and `process.env.ComSpec` on Windows. A different
271+
shell can be specified as a string. See [Shell Requirements][] and
272+
[Default Windows Shell][]. **Default:** `false` (no shell).
269273
* `callback` {Function} Called with the output when process terminates.
270274
* `error` {Error}
271275
* `stdout` {string|Buffer}
272276
* `stderr` {string|Buffer}
273277
* Returns: {ChildProcess}
274278

275279
The `child_process.execFile()` function is similar to [`child_process.exec()`][]
276-
except that it does not spawn a shell. Rather, the specified executable `file`
280+
except that it does not spawn a shell by default. Rather, the specified executable `file`
277281
is spawned directly as a new process making it slightly more efficient than
278282
[`child_process.exec()`][].
279283

@@ -312,6 +316,10 @@ async function getVersion() {
312316
getVersion();
313317
```
314318

319+
*Note*: If the `shell` option is enabled, do not pass unsanitized user input
320+
to this function. Any input containing shell metacharacters may be used to
321+
trigger arbitrary command execution.
322+
315323
### child_process.fork(modulePath[, args][, options])
316324
<!-- YAML
317325
added: v0.5.0
@@ -705,6 +713,10 @@ changes:
705713
* `encoding` {string} The encoding used for all stdio inputs and outputs. **Default:** `'buffer'`
706714
* `windowsHide` {boolean} Hide the subprocess console window that would
707715
normally be created on Windows systems. **Default:** `false`.
716+
* `shell` {boolean|string} If `true`, runs `command` inside of a shell. Uses
717+
`'/bin/sh'` on UNIX, and `process.env.ComSpec` on Windows. A different
718+
shell can be specified as a string. See [Shell Requirements][] and
719+
[Default Windows Shell][]. **Default:** `false` (no shell).
708720
* Returns: {Buffer|string} The stdout from the command.
709721

710722
The `child_process.execFileSync()` method is generally identical to
@@ -721,6 +733,10 @@ If the process times out or has a non-zero exit code, this method ***will***
721733
throw an [`Error`][] that will include the full result of the underlying
722734
[`child_process.spawnSync()`][].
723735

736+
*Note*: If the `shell` option is enabled, do not pass unsanitized user input
737+
to this function. Any input containing shell metacharacters may be used to
738+
trigger arbitrary command execution.
739+
724740
### child_process.execSync(command[, options])
725741
<!-- YAML
726742
added: v0.11.12

doc/api/http.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1878,6 +1878,49 @@ const req = http.request(options, (res) => {
18781878
});
18791879
```
18801880

1881+
In a successful request, the following events will be emitted in the following
1882+
order:
1883+
1884+
* `socket`
1885+
* `response`
1886+
* `data` any number of times, on the `res` object
1887+
(`data` will not be emitted at all if the response body is empty, for
1888+
instance, in most redirects)
1889+
* `end` on the `res` object
1890+
* `close`
1891+
1892+
In the case of a connection error, the following events will be emitted:
1893+
1894+
* `socket`
1895+
* `error`
1896+
* `close`
1897+
1898+
If `req.abort()` is called before the connection succeeds, the following events
1899+
will be emitted in the following order:
1900+
1901+
* `socket`
1902+
* (`req.abort()` called here)
1903+
* `abort`
1904+
* `close`
1905+
* `error` with an error with message `Error: socket hang up` and code
1906+
`ECONNRESET`
1907+
1908+
If `req.abort()` is called after the response is received, the following events
1909+
will be emitted in the following order:
1910+
1911+
* `socket`
1912+
* `response`
1913+
* `data` any number of times, on the `res` object
1914+
* (`req.abort()` called here)
1915+
* `abort`
1916+
* `close`
1917+
* `aborted` on the `res` object
1918+
* `end` on the `res` object
1919+
* `close` on the `res` object
1920+
1921+
Note that setting the `timeout` option or using the `setTimeout` function will
1922+
not abort the request or do anything besides add a `timeout` event.
1923+
18811924
[`'checkContinue'`]: #http_event_checkcontinue
18821925
[`'request'`]: #http_event_request
18831926
[`'response'`]: #http_event_response

doc/api/http2.md

Lines changed: 59 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ compatibility with the existing [HTTP/1][] module API. However,
1919
the [Compatibility API][] is.
2020

2121
The `http2` Core API is much more symmetric between client and server than the
22-
`http` API. For instance, most events, like `error` and `socketError`, can be
23-
emitted either by client-side code or server-side code.
22+
`http` API. For instance, most events, like `error`, `connect` and `stream`, can
23+
be emitted either by client-side code or server-side code.
2424

2525
### Server-side example
2626

@@ -36,7 +36,6 @@ const server = http2.createSecureServer({
3636
cert: fs.readFileSync('localhost-cert.pem')
3737
});
3838
server.on('error', (err) => console.error(err));
39-
server.on('socketError', (err) => console.error(err));
4039

4140
server.on('stream', (stream, headers) => {
4241
// stream is a Duplex
@@ -68,7 +67,6 @@ const client = http2.connect('https://localhost:8443', {
6867
ca: fs.readFileSync('localhost-cert.pem')
6968
});
7069
client.on('error', (err) => console.error(err));
71-
client.on('socketError', (err) => console.error(err));
7270

7371
const req = client.request({ ':path': '/' });
7472

@@ -479,44 +477,6 @@ Used to set a callback function that is called when there is no activity on
479477
the `Http2Session` after `msecs` milliseconds. The given `callback` is
480478
registered as a listener on the `'timeout'` event.
481479

482-
#### http2session.close(options[, callback])
483-
<!-- YAML
484-
added: v8.4.0
485-
-->
486-
487-
* `options` {Object}
488-
* `errorCode` {number} The HTTP/2 [error code][] to return. Note that this is
489-
*not* the same thing as an HTTP Response Status Code. **Default:** `0x00`
490-
(No Error).
491-
* `lastStreamID` {number} The Stream ID of the last successfully processed
492-
`Http2Stream` on this `Http2Session`. If unspecified, will default to the
493-
ID of the most recently received stream.
494-
* `opaqueData` {Buffer|Uint8Array} A `Buffer` or `Uint8Array` instance
495-
containing arbitrary additional data to send to the peer upon disconnection.
496-
This is used, typically, to provide additional data for debugging failures,
497-
if necessary.
498-
* `callback` {Function} A callback that is invoked after the session shutdown
499-
has been completed.
500-
* Returns: {undefined}
501-
502-
Attempts to shut down this `Http2Session` using HTTP/2 defined procedures.
503-
If specified, the given `callback` function will be invoked once the shutdown
504-
process has completed.
505-
506-
If the `Http2Session` instance is a server-side session and the `errorCode`
507-
option is `0x00` (No Error), a "graceful" shutdown will be initiated. During a
508-
"graceful" shutdown, the session will first send a `GOAWAY` frame to
509-
the connected peer identifying the last processed stream as 2<sup>31</sup>-1.
510-
Then, on the next tick of the event loop, a second `GOAWAY` frame identifying
511-
the most recently processed stream identifier is sent. This process allows the
512-
remote peer to begin preparing for the connection to be terminated.
513-
514-
```js
515-
session.close({
516-
opaqueData: Buffer.from('add some debugging data here')
517-
}, () => session.destroy());
518-
```
519-
520480
#### http2session.socket
521481
<!-- YAML
522482
added: v8.4.0
@@ -686,19 +646,23 @@ added: v8.4.0
686646
added: v9.4.0
687647
-->
688648

649+
* `alt`: {string}
650+
* `origin`: {string}
651+
* `streamId`: {number}
652+
689653
The `'altsvc'` event is emitted whenever an `ALTSVC` frame is received by
690654
the client. The event is emitted with the `ALTSVC` value, origin, and stream
691-
ID, if any. If no `origin` is provided in the `ALTSVC` frame, `origin` will
655+
ID. If no `origin` is provided in the `ALTSVC` frame, `origin` will
692656
be an empty string.
693657

694658
```js
695659
const http2 = require('http2');
696660
const client = http2.connect('https://example.org');
697661

698-
client.on('altsvc', (alt, origin, stream) => {
662+
client.on('altsvc', (alt, origin, streamId) => {
699663
console.log(alt);
700664
console.log(origin);
701-
console.log(stream);
665+
console.log(streamId);
702666
});
703667
```
704668

@@ -1472,10 +1436,9 @@ added: v8.4.0
14721436

14731437
* Extends: {net.Server}
14741438

1475-
In `Http2Server`, there is no `'clientError'` event as there is in
1476-
HTTP1. However, there are `'socketError'`, `'sessionError'`, and
1477-
`'streamError'`, for errors emitted on the socket, `Http2Session`, or
1478-
`Http2Stream`.
1439+
In `Http2Server`, there are no `'clientError'` events as there are in
1440+
HTTP1. However, there are `'sessionError'`, and `'streamError'` events for
1441+
errors emitted on the socket, or from `Http2Session` or `Http2Stream` instances.
14791442

14801443
#### Event: 'checkContinue'
14811444
<!-- YAML
@@ -1580,23 +1543,54 @@ added: v8.4.0
15801543

15811544
* Extends: {tls.Server}
15821545

1583-
#### Event: 'sessionError'
1546+
#### Event: 'checkContinue'
1547+
<!-- YAML
1548+
added: v8.5.0
1549+
-->
1550+
1551+
* `request` {http2.Http2ServerRequest}
1552+
* `response` {http2.Http2ServerResponse}
1553+
1554+
If a [`'request'`][] listener is registered or [`http2.createSecureServer()`][]
1555+
is supplied a callback function, the `'checkContinue'` event is emitted each
1556+
time a request with an HTTP `Expect: 100-continue` is received. If this event
1557+
is not listened for, the server will automatically respond with a status
1558+
`100 Continue` as appropriate.
1559+
1560+
Handling this event involves calling [`response.writeContinue()`][] if the client
1561+
should continue to send the request body, or generating an appropriate HTTP
1562+
response (e.g. 400 Bad Request) if the client should not continue to send the
1563+
request body.
1564+
1565+
Note that when this event is emitted and handled, the [`'request'`][] event will
1566+
not be emitted.
1567+
1568+
#### Event: 'request'
15841569
<!-- YAML
15851570
added: v8.4.0
15861571
-->
15871572

1588-
The `'sessionError'` event is emitted when an `'error'` event is emitted by
1589-
an `Http2Session` object associated with the `Http2SecureServer`.
1573+
* `request` {http2.Http2ServerRequest}
1574+
* `response` {http2.Http2ServerResponse}
15901575

1591-
#### Event: 'unknownProtocol'
1576+
Emitted each time there is a request. Note that there may be multiple requests
1577+
per session. See the [Compatibility API][].
1578+
1579+
#### Event: 'session'
15921580
<!-- YAML
15931581
added: v8.4.0
15941582
-->
15951583

1596-
The `'unknownProtocol'` event is emitted when a connecting client fails to
1597-
negotiate an allowed protocol (i.e. HTTP/2 or HTTP/1.1). The event handler
1598-
receives the socket for handling. If no listener is registered for this event,
1599-
the connection is terminated. See the [Compatibility API][].
1584+
The `'session'` event is emitted when a new `Http2Session` is created by the
1585+
`Http2SecureServer`.
1586+
1587+
#### Event: 'sessionError'
1588+
<!-- YAML
1589+
added: v8.4.0
1590+
-->
1591+
1592+
The `'sessionError'` event is emitted when an `'error'` event is emitted by
1593+
an `Http2Session` object associated with the `Http2SecureServer`.
16001594

16011595
#### Event: 'stream'
16021596
<!-- YAML
@@ -1631,43 +1625,23 @@ server.on('stream', (stream, headers, flags) => {
16311625
});
16321626
```
16331627

1634-
#### Event: 'request'
1628+
#### Event: 'timeout'
16351629
<!-- YAML
16361630
added: v8.4.0
16371631
-->
16381632

1639-
* `request` {http2.Http2ServerRequest}
1640-
* `response` {http2.Http2ServerResponse}
1641-
1642-
Emitted each time there is a request. Note that there may be multiple requests
1643-
per session. See the [Compatibility API][].
1633+
The `'timeout'` event is emitted when there is no activity on the Server for
1634+
a given number of milliseconds set using `http2secureServer.setTimeout()`.
16441635

1645-
#### Event: 'timeout'
1636+
#### Event: 'unknownProtocol'
16461637
<!-- YAML
16471638
added: v8.4.0
16481639
-->
16491640

1650-
#### Event: 'checkContinue'
1651-
<!-- YAML
1652-
added: v8.5.0
1653-
-->
1654-
1655-
* `request` {http2.Http2ServerRequest}
1656-
* `response` {http2.Http2ServerResponse}
1657-
1658-
If a [`'request'`][] listener is registered or [`http2.createSecureServer()`][]
1659-
is supplied a callback function, the `'checkContinue'` event is emitted each
1660-
time a request with an HTTP `Expect: 100-continue` is received. If this event
1661-
is not listened for, the server will automatically respond with a status
1662-
`100 Continue` as appropriate.
1663-
1664-
Handling this event involves calling [`response.writeContinue()`][] if the client
1665-
should continue to send the request body, or generating an appropriate HTTP
1666-
response (e.g. 400 Bad Request) if the client should not continue to send the
1667-
request body.
1668-
1669-
Note that when this event is emitted and handled, the [`'request'`][] event will
1670-
not be emitted.
1641+
The `'unknownProtocol'` event is emitted when a connecting client fails to
1642+
negotiate an allowed protocol (i.e. HTTP/2 or HTTP/1.1). The event handler
1643+
receives the socket for handling. If no listener is registered for this event,
1644+
the connection is terminated. See the [Compatibility API][].
16711645

16721646
### http2.createServer(options[, onRequestHandler])
16731647
<!-- YAML

0 commit comments

Comments
 (0)