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

6438 Commits

Author SHA1 Message Date
Joyee Cheung
804138093a src: use NativeModuleLoader to compile per_context.js
This patch introduces a NativeModuleLoader::CompileAndCall that
can run a JS script under `lib/` as a function called
with a null receiver and arguments specified from the C++ layer.
Since all our bootstrappers are wrapped in functions in the
source to avoid leaking variables into the global scope anyway,
this allows us to remove that extra indentation in the JS source code.

As a start we move the compilation and execution of per_context.js
to NativeModuleLoader::CompileAndCall(). This patch also changes the
return value of NativeModuleLoader::LookupAndCompile() to a MaybeLocal
since the caller has to take care of the result being empty
anyway.

This patch reverts the previous design of having the
NativeModuleLoader::Compile() method magically know about the
parameters of the function - until we have tooling
in-place to guess the parameter names in the source with some
annotation, it's more readable to allow the caller to specify
the parameters along with the arguments values.

PR-URL: https://github.com/nodejs/node/pull/24660
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Gus Caplan <me@gus.host>
2018-11-28 11:05:28 -08:00
Gireesh Punathil
25ad8decc6 lib: rearm pre-existing signal event registrations
process.on('somesignal', ...) semantics expect the process to catch the
signal and invoke the associated handler. `setupSignalHandlers` perform
the additional task of preparing the libuv signal handler and associate
it with the event handler. It is possible that by the time this is
setup there could be pre-existing registrations that pre-date this setup
in the boot sequence.

So rearm pre-existing signal event registrations to get upto speed.

Ref: https://github.com/nodejs/node/pull/22712#discussion_r232457318

PR-URL: https://github.com/nodejs/node/pull/24651
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
2018-11-28 10:33:21 -08:00
Joyee Cheung
333783643e
console: lazy load process.stderr and process.stdout
This patch:

- Refactors the Console constructor: moves the property binding code
  into and the writable streams binding code into two methods defined
  on the Console.prototype with symbols.
- Refactors the global console creation: we only need to share the
  property binding code from the Console constructor. To bind the
  streams we can lazy load `process.stdio` and `process.stderr`
  so that we don't create these streams when they are not used.
  This significantly reduces the number of modules loaded during
  bootstrap. Also, by calling the refactored-out method directly
  we can skip the unnecessary typechecks when creating the global
  console and there is no need to create a temporary Console
  anymore.
- Refactors the error handler creation and the `write` method:
  use a `kUseStdout` symbol to tell the internals which stream
  should be loaded from the console instance. Also put the
  `write` method on the Console prototype so it just loads
  other properties directly off the console instance which simplifies
  the call sites.

Also leaves a few TODOs for further refactoring of the console
bootstrap.

PR-URL: https://github.com/nodejs/node/pull/24534
Reviewed-By: Gus Caplan <me@gus.host>
2018-11-29 01:52:54 +08:00
horihiro
b8bd4b454f lib: convert to arrow function
PR-URL: https://github.com/nodejs/node/pull/24623
Reviewed-By: Shingo Inoue <leko.noor@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Masashi Hirano <shisama07@gmail.com>
2018-11-28 19:23:54 +05:30
Daiki Arai
b02cac5b09 lib: convert to Arrow Function
convert to Arrow Function and test by `./tools/test.py tick-processor`
PR-URL: https://github.com/nodejs/node/pull/24615
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Masashi Hirano <shisama07@gmail.com>
2018-11-28 14:59:07 +05:30
Anatoli Papirovski
3ce9305a70 process: emit unhandled warning immediately
PR-URL: https://github.com/nodejs/node/pull/24632
Fixes: https://github.com/nodejs/node/issues/24209
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
2018-11-27 22:19:35 -08:00
DoiChris
7bc5300e2b stream: use arrow function for callback
In lib/internal/streams/async_iterator.js, use arrow function for
callback.

PR-URL: https://github.com/nodejs/node/pull/24609
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ron Korving <ron@ronkorving.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
2018-11-27 21:51:52 -08:00
Matteo Collina
b77f699a84 url: avoid hostname spoofing w/ javascript protocol
CVE-2018-12123

Fixes: https://github.com/nodejs-private/security/issues/205
PR-URL: https://github.com/nodejs-private/node-private/pull/145
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2018-11-28 11:36:34 +11:00
Matteo Collina
ee618a7ab2 http,https: protect against slow headers attack
CVE-2018-12122

An attacker can send a char/s within headers and exahust the resources
(file descriptors) of a system even with a tight max header length
protection. This PR destroys a socket if it has not received the headers
in 40s.

PR-URL: https://github.com/nodejs-private/node-private/pull/144
Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
2018-11-28 11:36:34 +11:00
Vse Mozhet Byt
1db808ca5f lib: fix comment nits in bootstrap\loaders.js
PR-URL: https://github.com/nodejs/node/pull/24641
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
2018-11-27 16:15:34 +02:00
Daniel Bevenius
567b9f86cc lib: suppress crypto related env vars in help msg
This commit adds a crypto check to suppress the crypto related
environment variables introduced in Commit
399bb3c95a ("doc: add NODE_DEBUG_NATIVE to API
docs").

Without this check, test/parallel/test-cli-node-print-help.js will fail
when configured --without-ssl, as it some of the descriptions for these
environment variables contain flags that the test is not expecting to find.

PR-URL: https://github.com/nodejs/node/pull/24556
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2018-11-27 05:41:34 +01:00
Naojirou Hisada
10cc32dd8b lib: convert to arrow function
PR-URL: https://github.com/nodejs/node/pull/24596
Reviewed-By: Ron Korving <ron@ronkorving.nl>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
2018-11-26 20:34:32 +05:30
yosuke ota
519923fbf9 crypto: convert to arrow function
Changed function expression to arrow function.

PR-URL: https://github.com/nodejs/node/pull/24597
Reviewed-By: Ron Korving <ron@ronkorving.nl>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
2018-11-26 17:42:38 +05:30
takato
39d25eb1e2 lib: change anonymous function to arrow function
PR-URL: https://github.com/nodejs/node/pull/24589
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Shingo Inoue <leko.noor@gmail.com>
2018-11-26 17:36:35 +05:30
Vse Mozhet Byt
f2432a4761 lib: simplify own keys retrieval
This replacement can save us a function call, two array spreadings,
and an array concatenation.

PR-URL: https://github.com/nodejs/node/pull/24582
Refs: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Reflect/ownKeys#Description
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2018-11-26 01:31:49 +02:00
Vse Mozhet Byt
14707b681d lib: fix nits in lib/internal/bootstrap/cache.js
* Unwrap short lines.
* Unify comments.
* Decrease function calls.

PR-URL: https://github.com/nodejs/node/pull/24581
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
2018-11-25 11:24:20 -08:00
Ouyang Yadong
9389b464ea net: emit "write after end" errors in the next tick
This commit makes those errors caused by calling
`net.Socket.write()` after sockets ending be emitted in the next
tick.

PR-URL: https://github.com/nodejs/node/pull/24457
Fixes: https://github.com/nodejs/node/issues/24111
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2018-11-24 23:46:02 -08:00
Gerhard Stoebich
f85d63609c crypto: allow monkey patching of pseudoRandomBytes
Make `pseudoRandomBytes` and it's aliases `prng` and `rng`
configurable to allow monkey patching.

PR-URL: https://github.com/nodejs/node/pull/24108
Refs: https://github.com/nodejs/node/pull/22519
Refs: https://github.com/nodejs/node/pull/23017
Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Ujjwal Sharma <usharma1998@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Vladimir de Turckheim <vlad2t@hotmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2018-11-24 18:26:17 -08:00
leeight
895fe2f574 http2: fix session[kSession] undefined issue
`finishSessionDestroy` session cleanup when already done.

PR-URL: https://github.com/nodejs/node/pull/24547
Fixes: https://github.com/nodejs/node/issues/24546
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Ouyang Yadong <oyydoibh@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2018-11-24 18:19:11 -08:00
Sam Roberts
f512f5ea13 tls: add min/max protocol version options
The existing secureProtocol option only allows setting the allowed
protocol to a specific version, or setting it to "all supported
versions". It also used obscure strings based on OpenSSL C API
functions. Directly setting the min or max is easier to use and explain.

PR-URL: https://github.com/nodejs/node/pull/24405
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Rod Vagg <rod@vagg.org>
2018-11-22 09:14:58 -08:00
Ouyang Yadong
33a25b29a4 net,dgram: add ipv6Only option for net and dgram
For TCP servers, the dual-stack support is enable by default, i.e.
binding host "::" will also make "0.0.0.0" bound. This commit add
ipv6Only option in `net.Server.listen()` and `dgram.createSocket()`
methods which allows to disable dual-stack support. Support for
cluster module is also provided in this commit.

Fixes: https://github.com/nodejs/node/issues/17664

PR-URL: https://github.com/nodejs/node/pull/23798
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
2018-11-22 21:45:08 +08:00
Morgan Roderick
91748dd89c http: change DEP0066 to a runtime deprecation
Change doc-only deprecation for _headers and _headerNames accessors to a
runtime deprecation.

PR-URL: https://github.com/nodejs/node/pull/24167
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
2018-11-22 04:45:27 -08:00
James M Snell
6026582462
http2: cleanup endStream logic
PR-URL: https://github.com/nodejs/node/pull/24063
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Note: Landed with one collaborator approval after PR
      was open for 18 days
2018-11-21 08:57:57 -08:00
James M Snell
ee80aaab13
http2: set js callbacks once
Make the http2 binding a bit more efficient by setting the callback
functions once when the module is loaded rather than for each
`Http2Session` and `Http2Stream`.

PR-URL: https://github.com/nodejs/node/pull/24063
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Note: Landed with one collaborator approval after PR
      was open for 18 days
2018-11-21 08:57:56 -08:00
James M Snell
e94d16daf2
http2: throw from mapToHeaders
PR-URL: https://github.com/nodejs/node/pull/24063
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Note: Landed with one collaborator approval after PR
      was open for 18 days
2018-11-21 08:57:56 -08:00
Matteo Collina
69cc58d0ab stream: correctly pause and resume after once('readable')
Fixes: https://github.com/nodejs/node/issues/24281

PR-URL: https://github.com/nodejs/node/pull/24366
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
2018-11-21 12:16:47 +01:00
Anna Henningsen
8dd8b8fad9 net,http2: merge after-write code
PR-URL: https://github.com/nodejs/node/pull/24380
Refs: https://github.com/nodejs/node/issues/19060
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
2018-11-21 09:53:49 +01:00
ZYSzys
db9a7459c3 lib: move encodeStr function to internal for reusable
PR-URL: https://github.com/nodejs/node/pull/24242
Reviewed-By: James M Snell <jasnell@gmail.com>
2018-11-20 18:24:02 -08:00
cjihrig
aa089bf23b
cli: add missing env vars to --help
This adds NODE_TLS_REJECT_UNAUTHORIZED, SSL_CERT_DIR,
SSL_CERT_FILE, and UV_THREADPOOL_SIZE to the --help menu.

PR-URL: https://github.com/nodejs/node/pull/24383
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Ouyang Yadong <oyydoibh@gmail.com>
Reviewed-By: Weijia Wang <starkwang@126.com>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
2018-11-20 19:25:20 -05:00
Timothy Gu
2a7432dade readline: add support for async iteration
Co-authored-by: Ivan Filenko <ivan.filenko@protonmail.com>
Fixes: https://github.com/nodejs/node/issues/18603
Refs: https://github.com/nodejs/node/pull/18904
PR-URL: https://github.com/nodejs/node/pull/23916
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Gus Caplan <me@gus.host>
2018-11-20 15:41:16 -08:00
Rich Trott
566a694bbc http2: replace unreachable error with assertion
"That particular `emit('error', ...)` is largely defensively coded and
should not ever actually happen." Sounds like an assertion rather than
an error event. The code in question has no test coverage because it is
believed to be unreachable.

Fixes: https://github.com/nodejs/node/issues/20673

PR-URL: https://github.com/nodejs/node/pull/24407
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: Trivikram Kamat <trivikr.dev@gmail.com>
2018-11-20 15:22:18 -08:00
gengjiawen
08c14d98cd console: improve code readability
use object spread to make console code more readable

PR-URL: https://github.com/nodejs/node/pull/24412
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2018-11-20 11:46:38 -08:00
ZYSzys
527b6096a4 http2: order declarations in http2.js
PR-URL: https://github.com/nodejs/node/pull/24411
Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2018-11-20 10:42:31 -08:00
rahulshuklab4u
fbc29164ea util: remove unreachable branch
Re-defining the array length will always set to 0.
Hence, the code branch can not be covered.

PR-URL: https://github.com/nodejs/node/pull/24447
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Weijia Wang <starkwang@126.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2018-11-20 12:50:15 -05:00
leeight
771585fcf5 lib: refactor setupInspector in bootstrap/node.js
`CJSModule` is not used in `setupGlobalConsole`, so we can move it to
`setupInspector` and remove the argument from `setupInspector`.

PR-URL: https://github.com/nodejs/node/pull/24446
Reviewed-By: Ouyang Yadong <oyydoibh@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
2018-11-20 06:05:56 +01:00
dexterleng
f86b7a998b fs: inline typeof check
PR-URL: https://github.com/nodejs/node/pull/24390
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Weijia Wang <starkwang@126.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2018-11-19 20:19:07 -08:00
Anto Aravinth
eb42c1eb4f repl: handle buffered string logic on finish
Looks like `clearBufferedCommand` will be called on almost all flows.
Hence history was broken.

PR-URL: https://github.com/nodejs/node/pull/24389
Fixes: https://github.com/nodejs/node/issues/24385
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
2018-11-19 10:47:41 -08:00
Joyee Cheung
7778c035a0
src: use STL containers instead of v8 values for static module data
Instead of putting the source code and the cache in v8::Objects,
put them in per-process std::maps. This has the following benefits:

- It's slightly lighter in weight compared to storing things on the
  v8 heap. Also it may be slightly faster since the preivous v8::Object
  is already in dictionary mode - though the difference is very small
  given the number of native modules is limited.
- The source and code cache generation templates are now much simpler
  since they just initialize static arrays and manipulate STL
  constructs.
- The static native module data can be accessed independently of any
  Environment or Isolate, and it's easy to look them up from the
  C++'s side.
- It's now impossible to mutate the source code used to compile
  native modules from the JS land since it's completely separate
  from the v8 heap. We can still get the constant strings from
  process.binding('natives') but that's all.

A few drive-by fixes:

- Remove DecorateErrorStack in LookupAndCompile - We don't need to
  capture the exception to decorate when we encounter
  errors during native module compilation, as those errors should be
  syntax errors and v8 is able to decorate them well. We use
  CompileFunctionInContext so there is no need to worry about
  wrappers either.
- The code cache could be rejected when node is started with v8 flags.
  Instead of aborting in that case, simply keep a record in the
  native_module_without_cache set.
- Refactor js2c.py a bit, reduce code duplication and inline Render()
  to make the one-byte/two-byte special treatment easier to read.

PR-URL: https://github.com/nodejs/node/pull/24384
Fixes: https://github.com/Remove
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2018-11-20 01:17:15 +08:00
ZYSzys
a3d9168293 events: extract listener check as a function
PR-URL: https://github.com/nodejs/node/pull/24303
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Denys Otrishko <shishugi@gmail.com>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2018-11-19 14:45:52 +01:00
Joyee Cheung
71f4d5abfa lib: set stderr._destroy to dummyDestroy
This seems to be typo: we are setting stdout._destroy instead of
stderr._destroy in the getter of stderr.

PR-URL: https://github.com/nodejs/node/pull/24398
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
2018-11-18 18:26:09 -08:00
Joyee Cheung
413fcada8f stream: do not use crypto.DEFAULT_ENCODING in lazy_transform.js
The default encoding can be retrieved via
`require('internal/crypto/util').getDefaultEncoding` instead of
the deprecated crypto.DEFAULT_ENCODING which triggers a warning.

Background:

The require chain goes like this:

```
internal/streams/lazy_transform.js
  -> crypto.js
  -> internal/crypto/cipher.js (uses LazyTransform in the global scope)
  -> internal/streams/lazy_transform.js
```

So when `internal/streams/lazy_transform.js` is required before
`lib/crypto.js`, we have a circular dependency and since
`internal/crypto/cipher.js` uses destructuring to use LazyTransform
we will get an error. And it can also trigger a warning if
lazy_transform.js is the first file that touches
crypto.DEFAULT_ENCODING.

PR-URL: https://github.com/nodejs/node/pull/24396
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2018-11-18 08:40:23 -08:00
Masashi Hirano
1e23e3ceb3 fs: make process.binding('fs') internal
Refs: https://github.com/nodejs/node/issues/22160

PR-URL: https://github.com/nodejs/node/pull/22478
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Denys Otrishko <shishugi@gmail.com>
2018-11-16 21:56:29 +09:00
Anna Henningsen
8cdb92f11c
Revert "net: partially revert "simplify Socket.prototype._final""
This reverts commit ac1f56c76a.

Refs: https://github.com/nodejs/node/pull/24288
Refs: https://github.com/nodejs/node/pull/24075

PR-URL: https://github.com/nodejs/node/pull/24290
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Reviewed-By: Ouyang Yadong <oyydoibh@gmail.com>
2018-11-16 10:09:42 +01:00
Anna Henningsen
b92d55f718
tls: destroy TLS socket if StreamWrap is destroyed
Previously, there was no mechanism in place that would
have destroyed the TLS socket once the underlying socket
had been closed.

PR-URL: https://github.com/nodejs/node/pull/24290
Refs: https://github.com/nodejs/node/pull/24288
Refs: https://github.com/nodejs/node/pull/24075
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Reviewed-By: Ouyang Yadong <oyydoibh@gmail.com>
2018-11-16 10:09:41 +01:00
Anna Henningsen
cbbf64e40e
tls: do not rely on 'drain' handlers in StreamWrap
`'drain'` event handlers may not be invoked if the stream
is currently finishing. Instead, use the fact that we know
when writes are active or not, and invoke the delayed shutdown
handler from our own after-write callback.

PR-URL: https://github.com/nodejs/node/pull/24290
Refs: https://github.com/nodejs/node/pull/24288
Refs: https://github.com/nodejs/node/pull/24075
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Reviewed-By: Ouyang Yadong <oyydoibh@gmail.com>
2018-11-16 10:09:40 +01:00
ZYSzys
1ddcccb7e3 lib: gather all errors constant in the same place for consistency
PR-URL: https://github.com/nodejs/node/pull/24038
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2018-11-15 11:50:56 -08:00
Jesse W. Collins
d4653d5a7d stream: change comment on duplex stream options
'options.XXX' did not convey to me how to use camelCase for different
readable and writable options on a duplex stream. Give an example
instead.

PR-URL: https://github.com/nodejs/node/pull/24247
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2018-11-15 11:48:27 -08:00
Rodger Combs
9b2ffff62c tls: emit a warning when servername is an IP address
Setting the TLS ServerName to an IP address is not permitted by
RFC6066. This will be ignored in a future version.

Refs: https://github.com/nodejs/node/pull/18127

PR-URL: https://github.com/nodejs/node/pull/23329
Fixes: https://github.com/nodejs/node/issues/18071
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
2018-11-15 23:30:13 +08:00
Anna Henningsen
c347e77647
net: always invoke after-write callback
This is part of the streams API contract, and aligns
network sockets with other streams in this respect.

PR-URL: https://github.com/nodejs/node/pull/24291
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Weijia Wang <starkwang@126.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
2018-11-15 15:33:35 +01:00
Dan Corman
4e6d28a710 lib: improved conditional check in zlib
PR-URL: https://github.com/nodejs/node/pull/24190
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
2018-11-14 20:40:36 -08:00