0
0
mirror of https://github.com/nodejs/node.git synced 2024-12-01 16:10:02 +01:00
Commit Graph

5083 Commits

Author SHA1 Message Date
Anatoli Papirovski
3c0ebf5aca
tools: enable additional eslint rules
Enable additional rules that node either already adheres to
or it makes sense to do so going forward: for-direction,
accessor-pairs, no-lonely-if and symbol-description.

Fix all instances of no-lonely-if in lib & test and disable
accessor-pairs in test-util-inspect.

PR-URL: https://github.com/nodejs/node/pull/16243
Refs: https://eslint.org/docs/rules/for-direction
Refs: https://eslint.org/docs/rules/accessor-pairs
Refs: https://eslint.org/docs/rules/no-lonely-if
Refs: https://eslint.org/docs/rules/symbol-description
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2017-10-19 13:54:14 -04:00
mog422
f2f391e575
http: send 400 bad request on parse error
A web server such as nginx assumes that upstream is dead
if upstream closes the socket without any response.

PR-URL: https://github.com/nodejs/node/pull/15324
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Ali Ijaz Sheikh <ofrobots@google.com>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Myles Borins <myles.borins@gmail.com>
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
2017-10-19 18:15:58 +02:00
Anna Henningsen
33b4320cf9
lib: refactor wrap_js_stream for ES6/readability
PR-URL: https://github.com/nodejs/node/pull/16158
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
2017-10-19 18:06:27 +02:00
Anna Henningsen
542e94cdce
lib: move _stream_wrap into internals
This makes a subsequent possible deprecation easier.

PR-URL: https://github.com/nodejs/node/pull/16158
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
2017-10-19 18:06:27 +02:00
Anatoli Papirovski
10ef56359e
lib: fix extraneous space in module.js
An extra space was not caught by the linter due to what appears
to be a bug in eslint 4.3.0 — remove it.

PR-URL: https://github.com/nodejs/node/pull/16199
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
2017-10-19 08:59:45 -04:00
Trivikram Kamat
1fd662c0e3
http2: simplify te header validation, add test
This simplifies validation of te header and adds a test case
in which array with two values is passed to param value in
isIllegalConnectionSpecificHeader

PR-URL: https://github.com/nodejs/node/pull/16246
Refs: https://github.com/nodejs/node/issues/14985
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
2017-10-19 07:53:09 -04:00
Andreas Madsen
7c079d1261
async_hooks: skip runtime checks when disabled
PR-URL: https://github.com/nodejs/node/pull/15454
Ref: https://github.com/nodejs/node/pull/14387
Ref: https://github.com/nodejs/node/pull/14722
Ref: https://github.com/nodejs/node/issues/14717
Ref: https://github.com/nodejs/node/issues/15448
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2017-10-19 12:45:21 +02:00
Anna Henningsen
5cde451ffd
fs: account for buffer alloc failure in readFile
PR-URL: https://github.com/nodejs/node/pull/16219
Refs: https://github.com/nodejs/node/pull/15362
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
2017-10-19 02:39:07 -02:00
zhangzifa
e647c5d7de timers: fix eventloop block
When there are at least 2 timers set by setInterval whose callback
execution are longer than interval, the eventloop will be blocked.

This commit fix the above bug.

PR-URL: https://github.com/nodejs/node/pull/15072
Fixes: https://github.com/nodejs/node/issues/15068
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
2017-10-18 11:59:11 -07:00
Michaël Zasso
70832bc353 build: add V8 embedder version string
After this commit, `process.versions.v8` will look like:
"6.0.287.53-node.0".
The goal is that everytime we apply a non-official patch to `deps/v8`,
we increment our own number instead of V8's patch level.
This number must be set back to 0 after major V8 updates.

Fixes: https://github.com/nodejs/node/issues/15698
PR-URL: https://github.com/nodejs/node/pull/15785
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Ali Ijaz Sheikh <ofrobots@google.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
2017-10-18 09:18:32 -07:00
Bryan English
3e144496d3 fs: remove no-longer-relevant comment
The comment suggests that the subsequent code could by DRYed up, due to
simply passing arguments along. However, in the commits since then, this
no longer appears to apply, and so the comment is now confusing with
respect to the current code.

PR-URL: https://github.com/nodejs/node/pull/16285
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2017-10-18 08:20:33 -07:00
Robert Nagy
5d99a9bf65 http: emit close as the last event in the client
Emit close event after all other events in the client, e.g.
error will be emitted before close.

PR-URL: https://github.com/nodejs/node/pull/15588
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2017-10-18 15:56:19 +02:00
Anna Henningsen
e6dfd59be0
lib: pass internalBinding more implicitly
Modify passing of the `internalBinding` function so that it’s
easier for core modules to adopt, and also not even accessible
through `--expose-internals`.

This also splits the module wrapper into a separate version for
internal bindings and for CJS modules, which seems like a good
idea given the different semantics.

PR-URL: https://github.com/nodejs/node/pull/16218
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2017-10-18 11:36:28 +02:00
Weijia Wang
212de3c5ec
lib: use destructuring for some constants
This change is to unify the declaration for constants into using
destructuring on the top-level-module scope, reducing some redundant
code.

PR-URL: https://github.com/nodejs/node/pull/16063
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
2017-10-16 23:34:32 +02:00
cjihrig
3b7a9a2589
child_process: add windowsHide option
This commit exposes the UV_PROCESS_WINDOWS_HIDE flag in Node
as a windowsHide option to the child_process methods. The
option is only applicable to Windows, and is ignored elsewhere.

Fixes: https://github.com/nodejs/node/issues/15217
PR-URL: https://github.com/nodejs/node/pull/15380
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
2017-10-16 16:19:54 -04:00
James M Snell
4cf56ad6f2 inspector: migrate to internal/errors
PR-URL: https://github.com/nodejs/node/pull/15619
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Ali Ijaz Sheikh <ofrobots@google.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
2017-10-16 09:31:18 -07:00
James M Snell
3ddc88b5c2 crypto: migrate Certificate to internal/errors
Move argument type checking to js, use internal/errors

PR-URL: https://github.com/nodejs/node/pull/15756
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2017-10-15 15:34:06 -07:00
matzavinos
7f55349079 net: convert to using internal/errors
Covert lib/net.js over to using lib/internal/errors.js

- Replace thrown errors in lib/net.js
  with errors from lib/internal/errors.
  The ERR_INVALID_OPT_VALUE error have been used
  in the Server.prototype.listen() method
- Update tests according to the above modifications

PR-URL: https://github.com/nodejs/node/pull/14782
Refs: https://github.com/nodejs/node/issues/11273
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
2017-10-15 11:48:38 +08:00
Orta
520cf1d6de doc: Update a typo in module.js' comments
PR-URL: https://github.com/nodejs/node/pull/16205
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
2017-10-15 10:37:22 +08:00
243083df
695b307cc6
module: minor performance improvement
PR-URL: https://github.com/nodejs/node/pull/16125
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2017-10-14 11:33:41 +02:00
Guy Bedford
d90dca6620
module: allow loading files with % in the name
PR-URL: https://github.com/nodejs/node/pull/16128
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Bradley Meck <bradley.meck@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
2017-10-14 11:21:10 +02:00
James M Snell
e5ad5456a2 events: migrate to internal/errors
PR-URL: https://github.com/nodejs/node/pull/15623
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2017-10-13 14:16:13 -07:00
r1cebank
c885ea727d lib: deprecate fd usage for fs.truncate(Sync)
PR-URL: https://github.com/nodejs/node/pull/15990
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2017-10-12 18:02:14 -07:00
Bradley Farias
a36aa049c8 src: add internalBindings for binding isolation
This commit adds a method to internal/process that allows access to
bindings that are not intended to be used by user code. It has a
separate cache object and modlist in order to avoid collisions.

You can use NODE_MODULE_CONTEXT_AWARE_INTERNAL to register a C++
module as an internal.

PR-URL: https://github.com/nodejs/node/pull/15759
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: Refael Ackermann <refack@gmail.com>
2017-10-12 09:13:29 -05:00
Jon Moss
0229e6746c repl: remove unused err argument
Not used by any callers in `lib/repl.js`, and is not public API.

PR-URL: https://github.com/nodejs/node/pull/16152
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Prince John Wesley <princejohnwesley@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2017-10-12 21:23:28 +08:00
Lance Ball
c5f54b1fad
repl: remove internal frames from runtime errors
When a user executes code in the REPLServer which generates an
exception, there is no need to display the REPLServer internal
stack frames.

PR-URL: https://github.com/nodejs/node/pull/15351
Reviewed-By: Prince John Wesley <princejohnwesley@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>

Refs: https://github.com/nodejs/node/pull/9601
2017-10-11 14:51:41 -04:00
guybedford
d21a11dc23 module: resolve and instantiate loader pipeline hooks
This enables a --loader flag for Node, which can provide custom
"resolve" and "dynamicInstantiate" methods for custom ES module
loading.

In the process, module providers have been converted from classes
into functions and the module APIs have been made to pass URL strings
over objects.

PR-URL: https://github.com/nodejs/node/pull/15445
Reviewed-By: Bradley Farias <bradley.meck@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
2017-10-11 08:47:23 -05:00
James Hodgskiss
e399abd582 net: change assert to conform to other files
PR-URL: https://github.com/nodejs/node/pull/15861
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2017-10-10 19:36:44 -07:00
Weijia Wang
c1cd731abc
url: using util._extend for improving profermace
`Object.assign` is much slower than `util._extend` according to
the refs. This change is to convert the `Object.assign` to use
`util._extend` in url module for improving profermance.

PR-URL: https://github.com/nodejs/node/pull/16081
Refs: https://github.com/nodejs/CTC/issues/62
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Brian White <mscdex@mscdex.net>
2017-10-10 17:16:36 -04:00
Matteo Collina
9bc4f86201 crypto: make createXYZ inlineable
This commit increase by around 10% hot code paths that are hitting
createXYZ functions. Before this change the createXYZ called the XYZ
constructor without new.

PR-URL: https://github.com/nodejs/node/pull/16067
Reviewed-By: Bryan English <bryan@bryanenglish.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Yosuke Furukawa <yosuke.furukawa@gmail.com>
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: Benedikt Meurer <benedikt.meurer@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
2017-10-09 11:40:13 +02:00
Trivikram Kamat
d6031bc1c6 test: http2 client destroy tests in one file
Refs: #14985
PR-URL: https://github.com/nodejs/node/pull/15749
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2017-10-07 09:46:58 -07:00
Anatoli Papirovski
2da7d9b820 http2: near full http1 compatibility, add tests
Extensive re-work of http1 compatibility layer based on tests in
express, on-finished and finalhandler. Fix handling of HEAD
method to match http1. Adjust write, end, etc. to call writeHead
as in http1 and as expected by user-land modules. Add socket
proxy that instead uses the Http2Stream for the vast majority of
socket interactions. Add and change tests to closer represent
http1 behaviour.

Refs: https://github.com/nodejs/node/pull/15633
Refs: https://github.com/expressjs/express/tree/master/test
Refs: https://github.com/jshttp/on-finished/blob/master/test/test.js
Refs: https://github.com/pillarjs/finalhandler/blob/master/test/test.js
PR-URL: https://github.com/nodejs/node/pull/15702
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2017-10-06 14:04:22 -07:00
John-David Dalton
42a2a9badb errors: make code and name properties settable
For internal errors, make `code` and `name` settable while keeping them
non-own properties by default.

PR-URL: https://github.com/nodejs/node/pull/15694
Fixes: https://github.com/nodejs/node/issues/15658
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
2017-10-04 15:49:36 -07:00
Rich Trott
6e172beaf0 errors: make properties mutable
Userland code can break if it depends on a mutable `code` property for
errors. Allow users to change the `code` property but do not propagate
changes to the error `name`.

Additionally, make `message` and `name` consistent with `Error` object
(non-enumerable). Test that `console.log()` and `.toString()` calls on
internal `Error` objects with mutated properties have analogous results
with the standard ECMAScript `Error` objects.

PR-URL: https://github.com/nodejs/node/pull/15694
Fixes: https://github.com/nodejs/node/issues/15658
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
2017-10-04 15:49:17 -07:00
Brian White
d545c948c2
util: use faster -0 check
PR-URL: https://github.com/nodejs/node/pull/15726
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Benedikt Meurer <benedikt.meurer@gmail.com>
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
2017-10-04 03:51:44 -04:00
Brian White
7cff6e80bf
async_hooks: fix reference in code comment
PR-URL: https://github.com/nodejs/node/pull/15748
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Andreas Madsen <amwebdk@gmail.com>
2017-10-03 06:24:54 -07:00
Timothy Gu
2f8ddb2734
inspector: reimplement JS binding
- Group all relevant methods/states into a C++ class.
- Uses internal fields instead of the less efficient v8::External for
  storing the pointer to the C++ object.
- Use AsyncWrap to allow instrumenting callback states.

PR-URL: https://github.com/nodejs/node/pull/15643
Refs: https://github.com/nodejs/node/issues/13503
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Eugene Ostroukhov <eostroukhov@google.com>
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2017-10-02 21:38:15 -07:00
Timothy Gu
71578198e3
module: add inspector to builtinLibs
PR-URL: https://github.com/nodejs/node/pull/15643
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Eugene Ostroukhov <eostroukhov@google.com>
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2017-10-02 21:37:59 -07:00
James M Snell
1261b94a3f doc: fix unassigned deprecation code
Forgot to assign the deprecation code when landing
1f8d527e94

PR-URL: https://github.com/nodejs/node/pull/15741
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
2017-10-02 19:09:05 -07:00
James M Snell
8f4db313f0 http2: refactor method arguments to avoid bools
PR-URL: https://github.com/nodejs/node/pull/15693
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
2017-10-02 15:57:22 -07:00
James M Snell
74891412f1 zlib: migrate to internal/errors
PR-URL: https://github.com/nodejs/node/pull/15618
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Minwoo Jung <minwoo@nodesource.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
2017-10-02 12:36:52 -07:00
James M Snell
1f8d527e94 path: deprecate internal _makeLong, replace
Replace the internal `path._makeLong()` with a public
`path.toLongUNCPath()` method. Add documentation.

PR-URL: https://github.com/nodejs/node/pull/14956
Ref: https://github.com/standard-things/esm/issues/66
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2017-10-02 11:30:19 -07:00
Trivikram Kamat
7f0183e6c3
http2: setting shuttingDown=true after validation
In shutdown(), shuttingDown was set to true before validating options.
If invalid options are passed, error was thrown and server remained in
shuttingDown state. This code change fixes it.

PR-URL: https://github.com/nodejs/node/pull/15676
Fixes: https://github.com/nodejs/node/issues/15666
Refs: https://github.com/nodejs/node/issues/14985
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
2017-10-01 23:59:00 -03:00
Timothy Gu
7907534a8d
lib: faster type checks for some types
PR-URL: https://github.com/nodejs/node/pull/15663
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Benedikt Meurer <benedikt.meurer@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2017-10-01 23:58:59 -03:00
jlvivero
34dbc9e4e8
stream: fix disparity between buffer and the count
This changes the disparity of bufferedRequestCount and the actual buffer
on file _stream_writable.js

PR-URL: https://github.com/nodejs/node/pull/15661
Fixes: https://github.com/nodejs/node/issues/6758
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2017-10-01 23:37:15 -03:00
Anatoli Papirovski
5723b5dbbc
tls: improve TLSSocket & Server performance
Limit the number of closures created and functions called
throughout the lifecycle of TLSSocket, Server & connect.

PR-URL: https://github.com/nodejs/node/pull/15575
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
2017-10-01 23:34:48 -03:00
Weijia Wang
43e7e8d106
crypto: remove useless if statement
The if statement in `ECDH.getPublicKey` is useless. This change
is to remove it.

PR-URL: https://github.com/nodejs/node/pull/15041
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
2017-10-01 23:31:43 -03:00
Ruben Bridgewater
da40050b59
repl: fix deprecation code
This slipped through while landing.

PR-URL: https://github.com/nodejs/node/pull/15668
Refs: https://github.com/nodejs/node/pull/15136
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
Reviewed-By: Prince John Wesley <princejohnwesley@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
2017-10-01 20:39:02 -03:00
Ruben Bridgewater
564d7ef473
stream: fix todo
With the update to v8 6.1 this todo can now be addressed.

PR-URL: https://github.com/nodejs/node/pull/15667
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Benedikt Meurer <benedikt.meurer@gmail.com>
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2017-10-01 20:38:18 -03:00
Ruben Bridgewater
db7d1339c3
stream: migrate to internal/errors
PR-URL: https://github.com/nodejs/node/pull/15665
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2017-10-01 20:37:00 -03:00
Ruben Bridgewater
4536128e7c
stream: remove dead code
This condition could never be met because all calling functions
guarded against this.

PR-URL: https://github.com/nodejs/node/pull/15665
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2017-10-01 20:36:39 -03:00
Bryan English
200e783e66
tty: require readline at top of file
No need to require it on each of those function calls.

PR-URL: https://github.com/nodejs/node/pull/15647
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
2017-10-01 20:24:01 -03:00
Anatoli Papirovski
ccd3afc843
http2: adjust error emit in core, add tests
Use the ability of nextTick and setImmediate to pass arguments
instead of creating closures or binding. Add tests that cover
the vast majority of error emits.

PR-URL: https://github.com/nodejs/node/pull/15586
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
2017-10-01 20:14:10 -03:00
Ben Noordhuis
2e59ec0c2d child_process: fix memory leak in .fork()
Entries in the `net.Server#_workers` array that is used to track handles
sent from the master to workers were not deleted when a worker exited,
resulting in a slow but inexorable memory leak.

PR-URL: https://github.com/nodejs/node/pull/15679
Fixes: https://github.com/nodejs/node/issues/15651
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2017-09-30 22:18:29 -07:00
Jeremiah Senkpiel
ce3586da31 timers: warn on overflowed timeout duration
Cherry-pick from ayo

Ayo commit log:
> Previously there wasn't any clear indicator when you hit the overflow
> other than possibly unexpected behavior, and I think emitting a warning
> may be appropriate.

> PR-URL: https://github.com/ayojs/ayo/pull/71
> Reviewed-By: Scott Trinh <scott@scotttrinh.com>
> Reviewed-By: Alexey Orlenko <eaglexrlnk@gmail.com>
> Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
> Reviewed-By: Anna Henningsen <anna@addaleax.net>
> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>

PR-URL: https://github.com/nodejs/node/pull/15627
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
2017-09-29 08:45:06 -07:00
Rami Moshe
4843c2f415 https: convert to using internal/errors
PR-URL: https://github.com/nodejs/node/pull/15603
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
2017-09-28 22:53:16 -07:00
Refael Ackermann
5f469446e1
errors,tools: ASCIIbetical instead of alphabetical
PR-URL: https://github.com/nodejs/node/pull/15578
Fixes: https://github.com/nodejs/node/issues/15576
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2017-09-28 09:16:20 -04:00
James M Snell
f55ee6e24a
http2: make --expose-http2 flag a non-op
Make the `http2` module always available.
The `--expose-http2` cli flag is made a non-op

PR-URL: https://github.com/nodejs/node/pull/15535
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Ali Ijaz Sheikh <ofrobots@google.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
2017-09-28 02:01:06 -03:00
Lance Ball
e416b3ee36
repl: deprecate turnOffEditorMode
This deprecates the current REPLServer.prototype.turnOffEditorMode
and adds a private function for turnOffEditorMode which handles the
necessary internal changes required instead of having them scattered
about.

PR-URL: https://github.com/nodejs/node/pull/15136
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Prince John Wesley <princejohnwesley@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
2017-09-28 01:54:03 -03:00
Bryan English
2043944a4c http: client keep-alive for UNIX domain sockets
Makes `Connection: keep-alive` behave correctly when making client
connections to UNIX domain sockets.

Prior to this, connections would never be re-used, but the keep-alive
would cause the connections to stick around until they time out. This
would lead to an eventual EMFILE error due to all the connections
staying open. This was due to http.Agent not properly supporting UNIX
domain sockets.

PR-URL: https://github.com/nodejs/node/pull/13214
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
2017-09-27 18:31:17 -07:00
Bryan English
26174fcfe1 crypto: expose ECDH class
For consistency with the rest of the crypto classes, exposes the ECDH
class. Originally, only the createECDH function was exposed, and there
was no real reason to hide the class.

PR-URL: https://github.com/nodejs/node/pull/8188
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2017-09-27 13:42:30 -07:00
Yang-Kichang
7d55b81999
url: change variable name to be more descriptive
PR-URL: https://github.com/nodejs/node/pull/15551
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
2017-09-27 00:39:29 +02:00
Michaël Zasso
cfee1c9778 path: fix normalize paths ending with two dots
Fixes: https://github.com/nodejs/security/issues/147
PR-URL: https://github.com/nodejs-private/node-private/pull/94
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Doug Wilson <doug@somethingdoug.com>
Reviewed-By: Myles Borins <myles.borins@gmail.com>
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
2017-09-26 14:59:54 -07:00
Andreas Madsen
3a69ef55e0
async_hooks: consistent internal naming
PR-URL: https://github.com/nodejs/node/pull/15569
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
2017-09-26 15:50:10 +02:00
Anatoli Papirovski
c705f1067c http2: fix compat stream read handling, add tests
Handle edge case where stream pause is called between resume being
called and actually evaluated. Other minor adjustments to avoid
various edge cases around stream events. Add new tests that cover
all changes.

Fixes: https://github.com/nodejs/node/issues/15491
PR-URL: https://github.com/nodejs/node/pull/15503
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2017-09-25 13:25:35 -07:00
Rich Trott
55d49eb3cc
errors: replace .split() with .replace()
Replace a somewhat idiosyncratic use of `split()` to remove a prefix
with `replace()`. (A case could be made for `slice()` as well but I
think this is more readable.)

PR-URL: https://github.com/nodejs/node/pull/15545
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
2017-09-24 13:02:47 -03:00
Rich Trott
cef6e1c55f
errors: refactor invalidArgType()
`invalidArgType()` uses `includes()` in two places where `startsWith()`
and `endsWith()` are more appropriate (at least in my opinion). Switch
to those more specific functions.

PR-URL: https://github.com/nodejs/node/pull/15544
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Minwoo Jung <minwoo@nodesource.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
2017-09-24 13:00:14 -03:00
Anatoli Papirovski
33760ccc18
http2: remove unused onTimeout, add timeout tests
Remove unused onTimeout on Http2Session and Http2Stream because
the correct _onTimeout is already declared and in use. Expand
timeout tests to handle edge cases and additional arguments.

PR-URL: https://github.com/nodejs/node/pull/15539
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
2017-09-24 12:57:35 -03:00
James M Snell
193926ecab
tls,doc: fix unallocated deprecation code
Deprecation was landed using `DEP00XX` instead of a properly
allocated deprecation code.

PR-URL: https://github.com/nodejs/node/pull/15534
Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2017-09-24 11:28:17 -03:00
Anna Henningsen
b605b15346
async_hooks: support promise resolve hook
Add a `promiseResolve()` hook.

PR-URL: https://github.com/nodejs/node/pull/15296
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2017-09-23 15:52:03 +02:00
Jackson Tian
9d7574eef5
module: deprecate Module._debug
The _debug of Module is undocumented and it useless here.

PR-URL: https://github.com/nodejs/node/pull/13948
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
2017-09-22 21:03:29 -03:00
Bryan English
6f1caadb85 tls: prefer path over port in connect
Makes tls.connect() behave as documented, preferring options.path over
options.port. This makes it consistent with net.connect(), so the
included test demonstrates that both behave in this way.

Also, for consistency, noting the precedence of options.path in net
doc.

PR-URL: https://github.com/nodejs/node/pull/14564
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
2017-09-22 16:30:24 -07:00
cjihrig
20259f9092
net: support passing null to listen()
This commit fixes a regression around the handling of null
as the port passed to Server#listen(). With this commit,
null, undefined, and 0 have the same behavior, which was the
case in Node 4.

Fixes: https://github.com/nodejs/node/issues/14205
PR-URL: https://github.com/nodejs/node/pull/14221
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2017-09-22 12:16:09 -04:00
cjihrig
6983157adf
dgram: refactor SO_RCVBUF and SO_SNDBUF methods
This commit refactors the get/set send/receive buffer size
methods in the following ways:

- Use booleans instead of strings and numbers to differentiate
between the send and receive buffers.
- Reduce the amount of branching and complexity in the C++ code.

Refs: https://github.com/nodejs/node/pull/13623
PR-URL: https://github.com/nodejs/node/pull/15483
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2017-09-22 09:35:50 -04:00
Anatoli Papirovski
bc23681aa2 http2: small fixes to compatibility layer
Expand argument validation through compat API, adjust behaviour
of response.end to not throw if stream already closed to match
http1, adjust behaviour of writeContinue to not throw if stream
already closed and other very small tweaks. Add tests for added
and fixed behaviour. Add tests for edge case behaviours of
setTimeout, createPushResponse, destroy, end and trailers.

PR-URL: https://github.com/nodejs/node/pull/15473
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Minwoo Jung <jmwsoft@gmail.com>
2017-09-21 09:21:53 +02:00
Matteo Collina
e5c290bed9 fs: refactor close to use destroy
Refactor close() to use destroy() and not vice versa in ReadStream.
Avoid races between WriteStream.close and WriteStream.write, by aliasing
close to end().

Fixes: https://github.com/nodejs/node/issues/2006
PR-URL: https://github.com/nodejs/node/pull/15407
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2017-09-21 09:09:05 +02:00
Eugene Ostroukhov
75606c4f69 inspector: break in eval script
Fixes: https://github.com/nodejs/node/issues/14577
PR-URL: https://github.com/nodejs/node/pull/14581
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
2017-09-20 09:18:16 -07:00
Jeremiah Senkpiel
11f7dcf91e
timers: do not expose .unref()._handle._list
The list is defunct at this point.
I believe this to be in effect a minor defect from
3eecdf9f14

PR-URL: https://github.com/nodejs/node/pull/8422
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Julien Gilli <jgilli@nodejs.org>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2017-09-20 11:12:41 -03:00
Anna Henningsen
602fd36d95
domain: remove .dispose()
`domain.dispose()` is generally considered an anti-pattern, has been
runtime-deprecated for over 4 years, and is a part of the `domain`
module that can not be emulated by `async_hooks`; so remove it.

Ref: https://nodejs.org/en/docs/guides/domain-postmortem/
Ref: 4a74fc9776

PR-URL: https://github.com/nodejs/node/pull/15412
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
2017-09-20 10:45:33 -03:00
Luigi Pinca
10be20a0e8
http: set socket timeout when socket connects
`request.setTimeout()` calls `socket.setTimeout()` as soon as a socket
is assigned to the request. This makes the `timeout` event to be
emitted on the request even if the underlying socket never connects.

This commit makes `socket.setTimeout()` to be called only when the
underlying socket is connected.

PR-URL: https://github.com/nodejs/node/pull/8895
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
2017-09-20 10:41:13 -03:00
Matteo Collina
8589c70c85 http: revert #14024 writable is never set to false
Setting writable = false in IncomingMessage.end made some errors
being swallowed in some very popular OSS libraries that we must
support. This commit add some of those use cases to the tests,
so we avoid further regressions.
We should reevaluate how to set writable = false in IncomingMessage
in a way that does not break the ecosystem.

See: https://github.com/nodejs/node/pull/14024
Fixes: https://github.com/nodejs/node/issues/15029
PR-URL: https://github.com/nodejs/node/pull/15404
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
2017-09-20 11:32:29 +02:00
Anatoli Papirovski
2f5bef4705 http2: expand list of known headers
Add access-control-*, dnt, forwarded, trailer, tk,
upgrade-insecure-requests, warning, x-content-type-options and
x-frame-options to known list of headers for HTTP2. Expand tests
to account for these headers.

Fixes: https://github.com/nodejs/node/issues/15337
Refs: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers
Refs: https://www.w3.org/TR/cors/#syntax
Refs: https://www.w3.org/2011/tracking-protection/drafts/tracking-dnt.html#dnt-header-field
Refs: https://tools.ietf.org/html/rfc7239#section-4
Refs: https://tools.ietf.org/html/rfc7230#section-4.4
Refs: https://www.w3.org/2011/tracking-protection/drafts/tracking-dnt.html#response-header-field
Refs: https://www.w3.org/TR/upgrade-insecure-requests/#preference
Refs: https://tools.ietf.org/html/rfc7234#section-5.5
Refs: https://fetch.spec.whatwg.org/#x-content-type-options-header
Refs: https://tools.ietf.org/html/rfc7034

PR-URL: https://github.com/nodejs/node/pull/15434
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
2017-09-20 01:23:11 -07:00
Daniel Bevenius
3c65a83ac5
timers: clarify lib/timer.js comment
PR-URL: https://github.com/nodejs/node/pull/11018
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Lance Ball <lball@redhat.com>
2017-09-19 21:48:17 -03:00
Ruben Bridgewater
b1c8f15c5f
util: use constructor name
When reaching the depth limit util.inspect always prints [Array]
or [Object] no matter if it is a subclass or not.
This fixes it by showing the actual constructor name instead.

PR-URL: https://github.com/nodejs/node/pull/14886
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
2017-09-19 20:24:24 -03:00
Ruben Bridgewater
4bcb1c3f75
lib: refactor console startup
PR-URL: https://github.com/nodejs/node/pull/15111
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
2017-09-19 20:20:03 -03:00
Ruben Bridgewater
db2e093e05
assert: handle enumerable symbol keys
PR-URL: https://github.com/nodejs/node/pull/15169
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
2017-09-19 20:13:02 -03:00
Ruben Bridgewater
faaefa8082
util: improve format performance
PR-URL: https://github.com/nodejs/node/pull/15422
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
2017-09-19 20:05:27 -03:00
James M Snell
c75f87cc4c crypto: refactor the crypto module
* Split single monolithic file into multiple
* Make Certificate methods static
* Allow randomFill(Sync) to use any ArrayBufferView
* Use internal/errors throughout
* Improve arg validation in Hash/Hmac
* Doc updates

PR-URL: https://github.com/nodejs/node/pull/15231
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
2017-09-18 08:10:59 -07:00
Anatoli Papirovski
8fa5fcc0ba http2: emit close event if request aborted
Fix Http2ServerRequest and Http2ServerResponse to emit close event
if the request is aborted before response.end can be called.

Fixes: https://github.com/nodejs/node/issues/15385
PR-URL: https://github.com/nodejs/node/pull/15415
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2017-09-18 16:22:09 +02:00
Anatoli Papirovski
a4e923f5c1 http2: fix subsequent end calls to not throw
Calling Http2ServerResponse.end multiple times should never
cause the code to throw an error, subsequent calls should
instead return false. Fix behaviour to match http1.

Fixes: https://github.com/nodejs/node/issues/15385
PR-URL: https://github.com/nodejs/node/pull/15414
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2017-09-18 12:28:24 +02:00
Ruben Bridgewater
b0d3bec95c
assert: use Same-value equality in deepStrictEqual
PR-URL: https://github.com/nodejs/node/pull/15398
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2017-09-15 23:37:22 -03:00
Ruben Bridgewater
2e8217c64e
assert: improve AssertionError in case of "Errors"
Showing the stack trace in a error message obfuscates the actual
message and should not be visible therefore.

PR-URL: https://github.com/nodejs/node/pull/15025
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
2017-09-15 18:51:44 -03:00
guybedford
dce72c2335 module: check file url passed to top-level import
Fixes: https://github.com/nodejs/node/issues/15374
PR-URL: https://github.com/nodejs/node/pull/15389
Reviewed-By: Bradley Farias <bradley.meck@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Bartosz Sosnowski <bartosz@janeasystems.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
2017-09-15 12:32:48 -07:00
James M Snell
d8a0364ad5 async_hooks,doc: some async_hooks improvements
Update docs and type checking for AsyncResource type

PR-URL: https://github.com/nodejs/node/pull/15103
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Andreas Madsen <amwebdk@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2017-09-15 09:06:13 -07:00
Ruben Bridgewater
bac313b086
util: fix out of bounds indices in util.inspect
This fixes a issue brought up in #15288.

PR-URL: https://github.com/nodejs/node/pull/14881
Refs: https://github.com/nodejs/node/issues/15288
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
2017-09-14 21:53:19 -03:00
Ruben Bridgewater
f9ad23dc91
util: refactor inspect for performance and more
The main optimizations are
- Removed visibleKeys
- Removed proxy cache
- Removed Object.assign
- No key concatenating anymore
- No key recalculating anymore
- Improved indentation logic
- Improved string escape logic
- Added many fast paths
- Optimized code branches a lot
- Optimized (boxed) primitive handling
- Inline code if possible
- Only check extra keys if necessary
- Guard against unnecessary more expensive calls

This also fixes a bug with special array number keys as e.g. "00".

Besides that there were lots of smaller optimizations, the
code got a bit cleaned up and a few more tests got in.

PR-URL: https://github.com/nodejs/node/pull/14881
Fixes: https://github.com/nodejs/node/issues/15288
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
2017-09-14 21:52:58 -03:00
Ruben Bridgewater
01652ccc68
util: add fast internal array join method
PR-URL: https://github.com/nodejs/node/pull/14881
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
2017-09-14 21:46:33 -03:00
Jon Moss
e9358af581 errors: remove duplicate error definition
Also fixes error being (now!) properly thrown by alphabetize-errors.

also properly enable lint rule

Was not using proper magic comment syntax before!

-URL: https://github.com/nodejs/node/pull/15307
Reviewed-By: Myles Borins <myles.borins@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2017-09-14 13:40:18 -07:00
Will Young
4ae0afb12b dgram: added setMulticastInterface()
Add wrapper for uv's uv_udp_set_multicast_interface which provides the
sender side mechanism to explicitly select an interface. The
equivalent receiver side mechanism is the optional 2nd argument of
addMembership().

PR-URL: https://github.com/nodejs/node/pull/7855
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2017-09-14 17:03:19 +02:00
Alex Gresnel
ed2f347f27
child_process: set shell to false in fork()
This commit ensures that spawn()'s shell option is unconditionally
set to false when fork() is called.

Refs: https://github.com/nodejs/node/pull/15299
Fixes: https://github.com/nodejs/node/issues/13983
PR-URL: https://github.com/nodejs/node/pull/15352
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2017-09-13 21:03:39 -04:00