0
0
mirror of https://github.com/nodejs/node.git synced 2024-11-29 23:16:30 +01:00
Commit Graph

21130 Commits

Author SHA1 Message Date
Sergey Golovin
c86fe511f4
module: replace magic numbers by constants
- add new constants
- replace "magic" numbers in "module" by constants

PR-URL: https://github.com/nodejs/node/pull/18785
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Minwoo Jung <minwoo@nodesource.com>
Reviewed-By: Weijia Wang <starkwang@126.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Matheus Marchini <matheus@sthima.com>
Reviewed-By: Jon Moss <me@jonathanmoss.me>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
2018-02-16 19:32:03 +01:00
juggernaut451
2960096a91
test: refactor of test-tls-over-http-tunnel
PR-URL: https://github.com/nodejs/node/pull/18784
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
2018-02-16 19:29:24 +01:00
Seth Brenith
862389b0aa
http: simplify checkInvalidHeaderChar
In the spirit of [17399](https://github.com/nodejs/node/pull/17399),
we can also simplify checkInvalidHeaderChar to use regex matching
instead of a loop. This makes it faster on long matches and slower
on short matches or non-matches. This change also includes some
sample data from an AcmeAir benchmark run, as a rough proxy for
real-world data.

PR-URL: https://github.com/nodejs/node/pull/18381
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Benedikt Meurer <benedikt.meurer@gmail.com>
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
2018-02-16 19:27:28 +01:00
Ben Noordhuis
3c29adb84f
test: make tls test more rigorous
* exit naturally, don't use process.exit()
* ensure callbacks are actually called

PR-URL: https://github.com/nodejs/node/pull/18792
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Matheus Marchini <matheus@sthima.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
2018-02-16 19:23:29 +01:00
juggernaut451
85893afb05
test: reduce benchmark test run time
The `millions` argument was missing.

PR-URL: https://github.com/nodejs/node/pull/18787
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2018-02-16 19:18:27 +01:00
Leko
befe675af8
test: try to connect after server was closed
PR-URL: https://github.com/nodejs/node/pull/18257
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
2018-02-16 19:12:50 +01:00
Santiago Gimeno
b74a6da5d0
child_process: fix stdio sockets creation
`readable` and `writable` properties can be passed directly to the
`net.Socket` constructor. This change also avoids an unnecessary call
to `read(0)` on the `stdin` socket. This behavior was disclosed when
trying to merge `libuv@1.19.0` and specifically this commit:
fd049399aa.

PR-URL: https://github.com/nodejs/node/pull/18701
Refs: https://github.com/libuv/libuv/pull/1655
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2018-02-16 19:11:03 +01:00
Matheus Marchini
f25104e136 doc: remove extra space in README.md
PR-URL: https://github.com/nodejs/node/pull/18822
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
2018-02-16 15:42:36 -02:00
Bamieh
941bc93f22
test: wrap countdown callback in common.mustCall
This adds a implicit common.mustCall to the callback provided to
the countdown.

PR-URL: https://github.com/nodejs/node/pull/18506
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2018-02-16 18:32:59 +01:00
Ruben Bridgewater
96c57fbfaa
lib: switch to Number.isNaN
Number.isNaN is now as fast as `val !== val`. Switch to the more
readable version. Also switch all `isNaN` to `Number.isNaN`.

PR-URL: https://github.com/nodejs/node/pull/18744
Reviewed-By: Weijia Wang <starkwang@126.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2018-02-16 18:09:56 +01:00
Ruben Bridgewater
43b8ce4ce7
buffer: remove obsolete NaN check
These two NaN entries are not necessary and we can safely remove them.

PR-URL: https://github.com/nodejs/node/pull/18744
Reviewed-By: Weijia Wang <starkwang@126.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2018-02-16 18:09:55 +01:00
Aaron Bieber
ef0e92eb82
test: update a few tests to work on OpenBSD
PR-URL: https://github.com/nodejs/node/pull/18543
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2018-02-16 18:02:29 +01:00
Aaron Bieber
bd4350ca08
lib: set process.execPath on OpenBSD
PR-URL: https://github.com/nodejs/node/pull/18543
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2018-02-16 18:02:28 +01:00
Jose M. Palacios Diaz
916cfeca77
lib,src: audit process.env in lib/ for setuid binary
Wrap SafeGetenv() in util binding with the purpose of protecting
the cases when env vars are accessed with the privileges of another
user in jsland.

PR-URL: https://github.com/nodejs/node/pull/18511
Fixes: https://github.com/nodejs/node/issues/9160
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2018-02-16 17:42:21 +01:00
Yihong Wang
ec9e7922bb
test: add lib path env when node_shared=true
When building the node with `--shared` option, the major output is the
shared library. However, we still build a node executable which links
to the shared lib. It's for testing purpose. When testing with the
executable, some test cases move/copy the executable, change the
relative path to the shared library and fail. Using lib path env would
solve the issue. However, in macOS, need to change the install name for
the shared library and use rpath in the executable. In AIX, `-brtl`
linker option rebinds the symbols in the executable and addon modules
could use them.

Signed-off-by: Yihong Wang <yh.wang@ibm.com>

PR-URL: https://github.com/nodejs/node/pull/18626
Refs: https://github.com/nodejs/node/issues/18535
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
2018-02-16 17:30:16 +01:00
Anna Henningsen
3e1e450f92
fs: use Persistent::Reset() for resetting handles
PR-URL: https://github.com/nodejs/node/pull/18650
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Kyle Farnung <kfarnung@microsoft.com>
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2018-02-16 17:26:21 +01:00
Ruben Bridgewater
703e37cf3f
process: deprecate process.assert()
This was never documented and the `assert` module should be used
instead.

PR-URL: https://github.com/nodejs/node/pull/18666
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2018-02-16 17:02:38 +01:00
Ruben Bridgewater
1bd32087ee
doc: fix deprecation number
PR-URL: https://github.com/nodejs/node/pull/18818
Refs: efb32592e1
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2018-02-16 16:59:40 +01:00
Ruben Bridgewater
15bb8437fd
tools: add assert.doesNotThrow eslint rule
Prohibit the usage of `assert.doesNotThrow()`.

PR-URL: https://github.com/nodejs/node/pull/18669
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2018-02-16 16:54:57 +01:00
Ruben Bridgewater
644fdd60d4
test: minor refactoring
Add punctuation and comments about code that should not throw.
Also remove a obsolete test and refactor some tests.

PR-URL: https://github.com/nodejs/node/pull/18669
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2018-02-16 16:54:07 +01:00
Ruben Bridgewater
caee112e52
test: remove assert.doesNotThrow()
There is actually no reason to use `assert.doesNotThrow()` in the
tests. If a test throws, just let the error bubble up right away
instead of first catching it and then rethrowing it.

PR-URL: https://github.com/nodejs/node/pull/18669
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2018-02-16 16:53:47 +01:00
Ruben Bridgewater
4d3c3f039a
tools: enable no-unsafe-finally
This enables the `no-unsafe-finally` eslint rule to make sure we
have a proper control flow in try / catch.

PR-URL: https://github.com/nodejs/node/pull/18745
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2018-02-16 16:42:43 +01:00
Sergey Golovin
d8d84eee18 fs: replace magic numbers by named constants
PR-URL: https://github.com/nodejs/node/pull/18757
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Myles Borins <myles.borins@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Vladimir de Turckheim <vlad2t@hotmail.com>
2018-02-16 13:35:36 -02:00
Ruben Bridgewater
759a083d44
doc: update buffer examples
Move the print statements below a console.log call.

PR-URL: https://github.com/nodejs/node/pull/18758
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com>
2018-02-16 16:01:28 +01:00
Daniel Bevenius
42c14c5c17 src: set thread local env in CreateEnvironment
This commit set the Environment as a thread local when CreateEnvironment
is called which is currently not being done. This would lead to a
segment fault if later node::AtExit is called without specifying the
environment parameter. This specific issue was reported by Electron.

If I recall correctly, back when this was implemented the motivation was
that if embedders have multiple environments per isolate they should be
using the AtExit functions that take an environment. This is not the
case with Electron which only create a single environment (as far as I
know), and if a native module calls AtExit this would lead to the
segment fault.

I was able to reproduce Electron issue and the provided test simulates
it. I was also able to use this patch and verify that it works for the
Electron issue as well.

PR-URL: https://github.com/nodejs/node/pull/18573
Refs: https://github.com/nodejs/node/pull/9163
Refs: https://github.com/electron/electron/issues/11299
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Matheus Marchini <matheus@sthima.com>
2018-02-16 07:27:08 +01:00
Ali Ijaz Sheikh
efb32592e1 src: deprecate legacy node::MakeCallback
The legacy MakeCallback functions do not provide a mechanism to
propagate async context. This means that any native modules using these
directly is likely breaking async debugging & tracing tools. For
example it is possible that such a module will cause incorrect async
stack traces to be reported (even when the module is not on the stack).

The new MakeCallback allow the user to specify the async context in
which the callback is to be executed.

Ref: https://github.com/nodejs/node/issues/13254
PR-URL: https://github.com/nodejs/node/pull/18632
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: Jan Krems <jan.krems@gmail.com>
Reviewed-By: Andreas Madsen <amwebdk@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
2018-02-15 17:44:48 -08:00
Rich Trott
3b9cc424a4 module: remove unused code in module.js
Remove unnecessary condition in lib/module.js.

Refs: https://github.com/nodejs/node/pull/18593#issuecomment-364927965

PR-URL: https://github.com/nodejs/node/pull/18768
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
2018-02-15 16:20:44 -08:00
Michaël Zasso
a16081cbad src: use non-deprecated V8 microtasks API
SetAutorunMicrotasks is deprecated and a warning will be emitted
starting from V8 6.5. Use the non-deprecated SetMicrotasksPolicy API
instead.

PR-URL: https://github.com/nodejs/node/pull/18753
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Reviewed-By: Yang Guo <yangguo@chromium.org>
2018-02-15 16:34:47 +01:00
陈刚
faeee11c1f stream: readable continues to read when push('')
PR-URL: https://github.com/nodejs/node/pull/18211
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
2018-02-15 12:39:17 +01:00
Miles Elam
baf8495078 http: process 100, 102-199 according to specs.
Adding ServerResponse.writeProcessing to send 102 status codes.

Added an `'information'` event to ClientRequest to handle
1xx status codes except 101 Upgrade.
101 Upgrade is excluded due to its non-informational
processing according to RFC7231, Section 6.2.2.

This affects several modules downstream that use the http
module, e.g., node-fetch, all of whom violate HTTP RFCs
due to this module. As such, this could introduce a
breaking change for downstream if HTTP standards were
ignored in an ad-hoc fashion.

See also RFC2518 RFC8297.

PR-URL: https://github.com/nodejs/node/pull/18033
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
2018-02-15 11:57:57 +01:00
Nikolai Vavilov
cfad44105d build,win: replace run-python subroutine with single find_python call
A subroutine does not work as a replacement for the `python` command
since one cannot use a subroutine call in a `for /F` loop.

PR-URL: https://github.com/nodejs/node/pull/18621
Reviewed-By: Bartosz Sosnowski <bartosz@janeasystems.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
2018-02-15 10:44:34 +01:00
Sho Miyamoto
28dc56dc71 fs: fix typo in promises.lchmod & lchown
PR-URL: https://github.com/nodejs/node/pull/18783
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
2018-02-14 23:57:57 +02:00
Antoine AMARA
138bdf6114 doc: update crypo Certficate class.
Update the dead link to <keygen> documentation.
Add a link to mozilla developper documentation because
W3C deleted the reference to this element.

Add a note to inform <keygen> element is deprecated since HTML 5.2.

PR-URL: https://github.com/nodejs/node/pull/18721
Fixes: https://github.com/nodejs/node/issues/18662
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com>
2018-02-14 23:05:56 +02:00
Kelvin Jin
d8ec49ed9d src: update trace event macros to v8 6.4 version
PR-URL: https://github.com/nodejs/node/pull/17640
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
2018-02-14 10:59:49 -08:00
Myles Borins
7dffabbb84 doc: move Fedor to TSC Emeritus
In a conversation Fedor requested that this PR be made. They plan
to continue working on core as a Collaborator. It is this committers
belief that if Fedor would like to join the TSC again in the future
there is no reason that could not be made possible.

Thanks for all the hard work!

PR-URL: https://github.com/nodejs/node/pull/18752
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.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: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: Ali Ijaz Sheikh <ofrobots@google.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Jon Moss <me@jonathanmoss.me>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
Reviewed-By: Evan Lucas <evanlucas@me.com>
2018-02-14 10:11:56 -08:00
cjihrig
92c86fd84d
test: add multiline repl input regression test
This commit adds a regression test for
de848ac1e0, which broke
multiline input in the REPL.

PR-URL: https://github.com/nodejs/node/pull/18718
Refs: https://github.com/nodejs/node/pull/17828
Refs: https://github.com/nodejs/node/pull/18715
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
2018-02-14 11:44:50 -05:00
cjihrig
755e07cb73
test: remove unnecessary timer
The timer in NAPI's test_callback_scope/test-resolve-async.js
can be removed. If the test fails, it will timeout on its own.
The extra timer increases the chances of the test being
flaky.

PR-URL: https://github.com/nodejs/node/pull/18719
Fixes: https://github.com/nodejs/node/issues/18702
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2018-02-14 10:24:51 -05:00
Guy Bedford
f1fc426cce module: support main w/o extension, pjson cache
This adds support for ensuring that the top-level main into Node is
supported loading when it has no extension for backwards-compat with
NodeJS bin workflows.

In addition package.json caching is implemented in the module lookup
process.

PR-URL: https://github.com/nodejs/node/pull/18728
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
2018-02-14 16:35:12 +02:00
Anna Henningsen
0e7b61229a
src: refactor WriteWrap and ShutdownWraps
Encapsulate stream requests more:

- `WriteWrap` and `ShutdownWrap` classes are now tailored to the
  streams on which they are used. In particular, for most streams
  these are now plain `AsyncWrap`s and do not carry the overhead
  of unused libuv request data.
- Provide generic `Write()` and `Shutdown()` methods that wrap
  around the actual implementations, and make *usage* of streams
  easier, rather than implementing; for example, wrap objects
  don’t need to be provided by callers anymore.
- Use `EmitAfterWrite()` and `EmitAfterShutdown()` handlers to
  call the corresponding JS handlers, rather than always trying
  to call them. This makes usage of streams by other C++ code
  easier and leaner.

Also fix up some tests that were previously not actually testing
asynchronicity when the comments indicated that they would.

PR-URL: https://github.com/nodejs/node/pull/18676
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2018-02-14 10:00:29 +01:00
Anna Henningsen
0ed9ea861b
test: make sure WriteWrap tests are actually async
PR-URL: https://github.com/nodejs/node/pull/18676
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2018-02-14 10:00:26 +01:00
Anna Henningsen
e1271c07c3
src: only set JSStreamWrap write req after write()
Otherwise `this[kCurrentWriteRequest]` is set to a value even
if one of the `write` calls throws.

This is needed in order not to break tests in a later commit.

PR-URL: https://github.com/nodejs/node/pull/18676
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2018-02-14 10:00:26 +01:00
Anna Henningsen
82c43aed16
tls_wrap: use DoTryWrite()
Use `DoTryWrite()` to write data to the underlying socket.
This does probably not make any difference in performance
because the callback is still deferred (for now), but
brings TLSWrap in line with other things that write to
streams.

PR-URL: https://github.com/nodejs/node/pull/18676
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2018-02-14 10:00:26 +01:00
Joyee Cheung
b2e20b002b
fs: extract binding error handling into a helper
PR-URL: https://github.com/nodejs/node/pull/18642
Reviewed-By: Jon Moss <me@jonathanmoss.me>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2018-02-14 03:56:44 -05:00
Joyee Cheung
18d23aa36e
src: do not redefine private for GenDebugSymbols
Redefining private breaks any private inheritance in the
included files. We can simply declare GenDebugSymbols()
as friends in related classes to gain the access that we need.

PR-URL: https://github.com/nodejs/node/pull/18653
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2018-02-14 03:55:15 -05:00
Daniel Bevenius
e9ba0cfd46 test: add crypto check to test-benchmark-tls
Currently when building --without-ssl a 'ERR_NO_CRYPTO' error is
reported.

This is not currently being picked up by the crypto-check lint rule as
it does not actually require any crypto modules directly, but instead
this is done by common/benchmark.

PR-URL: https://github.com/nodejs/node/pull/18724
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2018-02-14 06:25:34 +01:00
Anna Henningsen
80ac941407
doc: make linter happy
This was not caught by the linter because the release commit
for 6.13.0 came from a different branch, where we don’t apply it
like we do on the main branch.

Example failure: https://ci.nodejs.org/job/node-test-linter/16132/console

PR-URL: https://github.com/nodejs/node/pull/18769
Reviewed-By: Matheus Marchini <matheus@sthima.com>
2018-02-14 00:46:09 +01:00
Myles Borins
60e612d0b0
2018-01-13, Version 6.13.0 'Boron' (LTS)
This LTS release comes with 112 commits, 17 of which are considered
Semver-Minor. This includes 32 which are doc related, 30 which are test
related, 8 which are build / tool related and 1 commit which updates
a dependency.

Notable Changes:

* console:
  - added console.count() and console.clear() (James M Snell)
    https://github.com/nodejs/node/pull/12678
* crypto:
  - expose ECDH class (Bryan English)
    https://github.com/nodejs/node/pull/8188
  - added cypto.randomFill() and crypto.randomFillSync() (Evan Lucas)
    https://github.com/nodejs/node/pull/10209
  - warn on invalid authentication tag length (Tobias Nießen)
    https://github.com/nodejs/node/pull/17566
* deps:
  - upgrade libuv to 1.16.1 (cjihrig)
    https://github.com/nodejs/node/pull/16835
* dgram:
  - added socket.setMulticastInterface() (Will Young)
    https://github.com/nodejs/node/pull/7855
* http:
  - add agent.keepSocketAlive and agent.reuseSocket as to allow
    overridable keep-alive behavior of `Agent` (Fedor Indutny)
    https://github.com/nodejs/node/pull/13005
* lib:
  - return this from net.Socket.end() (Sam Roberts)
    https://github.com/nodejs/node/pull/13481
* module:
  - add builtinModules api that provides list of all builtin modules in
    Node (Jon Moss)
    https://github.com/nodejs/node/pull/16386
* net:
  - return this from getConnections() (Sam Roberts)
    https://github.com/nodejs/node/pull/13553
* promises:
  - more robust stringification for unhandled rejections (Timothy Gu)
    https://github.com/nodejs/node/pull/13784
* repl:
  - improve require() autocompletion (Alexey Orlenko)
    https://github.com/nodejs/node/pull/14409
* src:
  - add openssl-system-ca-path configure option (Daniel Bevenius)
    https://github.com/nodejs/node/pull/16790
  - add --use-bundled-ca --use-openssl-ca check (Daniel Bevenius)
    https://github.com/nodejs/node/pull/12087
  - add process.ppid (cjihrig)
    https://github.com/nodejs/node/pull/16839
* tls:
  - accept `lookup` option for `tls.connect()` (Fedor Indutny)
    https://github.com/nodejs/node/pull/12839
* tools, build:
  - a new macOS installer! (JP Wesselink)
    https://github.com/nodejs/node/pull/15179
* url:
  - WHATWG URL api support (James M Snell)
    https://github.com/nodejs/node/pull/7448
* util:
  - add %i and %f formatting specifiers (Roman Reiss)
    https://github.com/nodejs/node/pull/10308

PR-URL: https://github.com/nodejs/node/pull/18342
2018-02-13 14:01:52 -05:00
Anatoli Papirovski
e782715d0a
string_decoder: fix regressions
There are libraries which invoke StringDecoder using .call and
.inherits, which directly conflicts with making StringDecoder
be a class which can only be invoked with the new keyword.
Revert to declaring it as a function.

StringDecoder#lastNeed was not defined, redefine it using
the new interface and fix StringDecoder#lastTotal.

PR-URL: https://github.com/nodejs/node/pull/18723
Refs: https://github.com/nodejs/node/pull/18537
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
2018-02-13 08:03:23 -05:00
Myles Borins
b6000d8285
deps: patch V8 to 6.4.388.44
PR-URL: https://github.com/nodejs/node/pull/18687
Refs: https://github.com/v8/v8/compare/6.4.388.42...6.4.388.44
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
2018-02-13 01:22:19 -05:00
Sergey Golovin
6abce37f34
path: replace "magic" numbers by readable constants
PR-URL: https://github.com/nodejs/node/pull/18654
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Kyle Farnung <kfarnung@microsoft.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
2018-02-12 20:12:40 +01:00