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

Commit d21eee8

Browse files
committed
meta: merge node/master into node-chakracore/master
Merge 7a055f1 as of 2017-12-12 This commit was automatically generated. For any problems, please contact jackhorton Reviewed-By: Taylor Woll <tawoll@ntdev.microsoft.com>
2 parents bc073bf + 7a055f1 commit d21eee8

File tree

69 files changed

+1700
-1567
lines changed

Some content is hidden

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

69 files changed

+1700
-1567
lines changed

benchmark/fixtures/simple-http-server.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ module.exports = http.createServer(function(req, res) {
3434
const arg = params[2];
3535
const n_chunks = parseInt(params[3], 10);
3636
const resHow = params.length >= 5 ? params[4] : 'normal';
37-
const chunkedEnc = params.length >= 6 && params[5] === 'false' ? false : true;
37+
const chunkedEnc = params.length >= 6 && params[5] === '0' ? false : true;
3838
var status = 200;
3939

4040
var n, i;

benchmark/http/simple.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@ const bench = common.createBenchmark(main, {
88
len: [4, 1024, 102400],
99
chunks: [1, 4],
1010
c: [50, 500],
11-
chunkedEnc: ['true', 'false'],
11+
chunkedEnc: [1, 0],
1212
res: ['normal', 'setHeader', 'setHeaderWH']
1313
});
1414

1515
function main(conf) {
1616
process.env.PORT = PORT;
1717
var server = require('../fixtures/simple-http-server.js')
18-
.listen(process.env.PORT || common.PORT)
18+
.listen(PORT)
1919
.on('listening', function() {
2020
const path =
2121
`/${conf.type}/${conf.len}/${conf.chunks}/${conf.res}/${conf.chunkedEnc}`;

doc/api/modules.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ In this example, the variable `PI` is private to `circle.js`.
3838
The `module.exports` property can be assigned a new value (such as a function
3939
or object).
4040

41-
Below, `bar.js` makes use of the `square` module, which exports a constructor:
41+
Below, `bar.js` makes use of the `square` module, which exports a Square class:
4242

4343
```js
4444
const Square = require('./square.js');
@@ -50,10 +50,14 @@ The `square` module is defined in `square.js`:
5050

5151
```js
5252
// assigning to exports will not modify module, must use module.exports
53-
module.exports = (width) => {
54-
return {
55-
area: () => width ** 2
56-
};
53+
module.exports = class Square {
54+
constructor(width) {
55+
this.width = width;
56+
}
57+
58+
area() {
59+
return this.width ** 2;
60+
}
5761
};
5862
```
5963

doc/api/process.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@ terminal programs.
379379

380380
It is important to take note of the following:
381381

382-
* `SIGUSR1` is reserved by Node.js to start the debugger. It's possible to
382+
* `SIGUSR1` is reserved by Node.js to start the [debugger][]. It's possible to
383383
install a listener but doing so will _not_ stop the debugger from starting.
384384
* `SIGTERM` and `SIGINT` have default handlers on non-Windows platforms that
385385
resets the terminal mode before exiting with code `128 + signal number`. If
@@ -1971,6 +1971,7 @@ cases:
19711971
[`v8.setFlagsFromString()`]: v8.html#v8_v8_setflagsfromstring_flags
19721972
[Child Process]: child_process.html
19731973
[Cluster]: cluster.html
1974+
[debugger]: debugger.html
19741975
[Duplex]: stream.html#stream_duplex_and_transform_streams
19751976
[LTS]: https://github.com/nodejs/LTS/
19761977
[note on process I/O]: process.html#process_a_note_on_process_i_o

doc/api/tls.md

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,10 @@ changes:
455455
description: ALPN options are supported now.
456456
-->
457457

458-
* `socket` {net.Socket} An instance of [`net.Socket`][]
458+
* `socket` {net.Socket|stream.Duplex}
459+
On the server side, any `Duplex` stream. On the client side, any
460+
instance of [`net.Socket`][] (for generic `Duplex` stream support
461+
on the client side, [`tls.connect()`][] must be used).
459462
* `options` {Object}
460463
* `isServer`: The SSL/TLS protocol is asymmetrical, TLSSockets must know if
461464
they are to behave as a server or a client. If `true` the TLS socket will be
@@ -815,10 +818,12 @@ changes:
815818
* `port` {number} Port the client should connect to.
816819
* `path` {string} Creates unix socket connection to path. If this option is
817820
specified, `host` and `port` are ignored.
818-
* `socket` {net.Socket} Establish secure connection on a given socket rather
819-
than creating a new socket. If this option is specified, `path`, `host` and
820-
`port` are ignored. Usually, a socket is already connected when passed to
821-
`tls.connect()`, but it can be connected later. Note that
821+
* `socket` {stream.Duplex} Establish secure connection on a given socket
822+
rather than creating a new socket. Typically, this is an instance of
823+
[`net.Socket`][], but any `Duplex` stream is allowed.
824+
If this option is specified, `path`, `host` and `port` are ignored,
825+
except for certificate validation. Usually, a socket is already connected
826+
when passed to `tls.connect()`, but it can be connected later. Note that
822827
connection/disconnection/destruction of `socket` is the user's
823828
responsibility, calling `tls.connect()` will not cause `net.connect()` to be
824829
called.

lib/_http_client.js

Lines changed: 2 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -41,33 +41,7 @@ const { outHeadersKey } = require('internal/http');
4141
const { nextTick } = require('internal/process/next_tick');
4242
const errors = require('internal/errors');
4343

44-
// The actual list of disallowed characters in regexp form is more like:
45-
// /[^A-Za-z0-9\-._~!$&'()*+,;=/:@]/
46-
// with an additional rule for ignoring percentage-escaped characters, but
47-
// that's a) hard to capture in a regular expression that performs well, and
48-
// b) possibly too restrictive for real-world usage. So instead we restrict the
49-
// filter to just control characters and spaces.
50-
//
51-
// This function is used in the case of small paths, where manual character code
52-
// checks can greatly outperform the equivalent regexp (tested in V8 5.4).
53-
function isInvalidPath(s) {
54-
var i = 0;
55-
if (s.charCodeAt(0) <= 32) return true;
56-
if (++i >= s.length) return false;
57-
if (s.charCodeAt(1) <= 32) return true;
58-
if (++i >= s.length) return false;
59-
if (s.charCodeAt(2) <= 32) return true;
60-
if (++i >= s.length) return false;
61-
if (s.charCodeAt(3) <= 32) return true;
62-
if (++i >= s.length) return false;
63-
if (s.charCodeAt(4) <= 32) return true;
64-
if (++i >= s.length) return false;
65-
if (s.charCodeAt(5) <= 32) return true;
66-
++i;
67-
for (; i < s.length; ++i)
68-
if (s.charCodeAt(i) <= 32) return true;
69-
return false;
70-
}
44+
const INVALID_PATH_REGEX = /[^\u0021-\u00ff]/;
7145

7246
function validateHost(host, name) {
7347
if (host != null && typeof host !== 'string') {
@@ -117,13 +91,7 @@ function ClientRequest(options, cb) {
11791
var path;
11892
if (options.path) {
11993
path = String(options.path);
120-
var invalidPath;
121-
if (path.length <= 39) { // Determined experimentally in V8 5.4
122-
invalidPath = isInvalidPath(path);
123-
} else {
124-
invalidPath = /[\u0000-\u0020]/.test(path);
125-
}
126-
if (invalidPath)
94+
if (INVALID_PATH_REGEX.test(path))
12795
throw new errors.TypeError('ERR_UNESCAPED_CHARACTERS', 'Request path');
12896
}
12997

lib/_tls_legacy.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -949,6 +949,6 @@ module.exports = {
949949
createSecurePair:
950950
internalUtil.deprecate(createSecurePair,
951951
'tls.createSecurePair() is deprecated. Please use ' +
952-
'tls.Socket instead.', 'DEP0064'),
952+
'tls.TLSSocket instead.', 'DEP0064'),
953953
pipe
954954
};

lib/net.js

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -380,15 +380,6 @@ Socket.prototype.read = function(n) {
380380
return this.read(n);
381381
};
382382

383-
384-
// FIXME(joyeecheung): this method is neither documented nor tested
385-
Socket.prototype.listen = function() {
386-
debug('socket.listen');
387-
this.on('connection', arguments[0]);
388-
listenInCluster(this, null, null, null);
389-
};
390-
391-
392383
Socket.prototype.setTimeout = function(msecs, callback) {
393384
if (msecs === 0) {
394385
timers.unenroll(this);

lib/repl.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ function hasOwnProperty(obj, prop) {
103103
// This is the default "writer" value if none is passed in the REPL options.
104104
const writer = exports.writer = (obj) => util.inspect(obj, writer.options);
105105
writer.options =
106-
Object.assign(util.inspect.defaultOptions, { showProxy: true });
106+
Object.assign({}, util.inspect.defaultOptions, { showProxy: true });
107107

108108
exports._builtinLibs = internalModule.builtinLibs;
109109

@@ -470,7 +470,7 @@ function REPLServer(prompt,
470470
if (self.useColors && self.writer === writer) {
471471
// Turn on ANSI coloring.
472472
self.writer = (obj) => util.inspect(obj, self.writer.options);
473-
self.writer.options = Object.assign(writer.options, { colors: true });
473+
self.writer.options = Object.assign({}, writer.options, { colors: true });
474474
}
475475

476476
function filterInternalStackFrames(error, structuredStack) {

src/inspector_agent.cc

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -325,10 +325,12 @@ class NodeInspectorClient : public V8InspectorClient {
325325
}
326326

327327
void maxAsyncCallStackDepthChanged(int depth) override {
328-
if (depth == 0) {
329-
env_->inspector_agent()->DisableAsyncHook();
330-
} else {
331-
env_->inspector_agent()->EnableAsyncHook();
328+
if (auto agent = env_->inspector_agent()) {
329+
if (depth == 0) {
330+
agent->DisableAsyncHook();
331+
} else {
332+
agent->EnableAsyncHook();
333+
}
332334
}
333335
}
334336

@@ -548,10 +550,6 @@ void Agent::Connect(InspectorSessionDelegate* delegate) {
548550
client_->connectFrontend(delegate);
549551
}
550552

551-
bool Agent::IsConnected() {
552-
return io_ && io_->IsConnected();
553-
}
554-
555553
void Agent::WaitForDisconnect() {
556554
CHECK_NE(client_, nullptr);
557555
client_->contextDestroyed(parent_env_->context());

0 commit comments

Comments
 (0)