Anna Henningsen
559a8e342b
http2: do not crash on stream listener removal w/ destroyed session
...
Do not crash when the session is no longer available.
Fixes: https://github.com/nodejs/node/issues/29457
PR-URL: https://github.com/nodejs/node/pull/29459
Backport-PR-URL: https://github.com/nodejs/node/pull/29618
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
Reviewed-By: Minwoo Jung <minwoo@nodesource.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
2019-09-25 13:28:09 +01:00
Luigi Pinca
3ee076f03d
stream: ensure writable.destroy() emits error once
...
Prevent the `'error'` event from being emitted multiple times if
`writable.destroy()` is called with an error before the `_destroy()`
callback is called.
Emit the first error, discard all others.
PR-URL: https://github.com/nodejs/node/pull/26057
Backport-PR-URL: https://github.com/nodejs/node/pull/28000
Fixes: https://github.com/nodejs/node/issues/26015
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: James M Snell <jasnell@gmail.com >
2019-09-19 17:10:42 +01:00
Anna Henningsen
dd60d3561a
http2: only call into JS when necessary for session events
...
For some JS events, it only makes sense to call into JS when there
are listeners for the event in question.
The overhead is noticeable if a lot of these events are emitted during
the lifetime of a session. To reduce this overhead, keep track of
whether any/how many JS listeners are present, and if there are none,
skip calls into JS altogether.
This is part of performance improvements to mitigate CVE-2019-9513.
Backport-PR-URL: https://github.com/nodejs/node/pull/29124
PR-URL: https://github.com/nodejs/node/pull/29122
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2019-08-15 17:36:36 +01:00
Anna Henningsen
00f6846b73
http2: improve JS-side debug logging
...
DRY up the `debug()` calls, and in particular, avoid building template
strings before we know whether we need to.
Backport-PR-URL: https://github.com/nodejs/node/pull/29124
PR-URL: https://github.com/nodejs/node/pull/29122
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2019-08-15 17:36:23 +01:00
James M Snell
b095e35f1f
http2: improve http2 code a bit
...
Multiple general improvements to http2 internals for
readability and efficiency
[This backport applied to v10.x cleanly but had several
merge conflicts on v8.x.]
PR-URL: https://github.com/nodejs/node/pull/23984
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
Reviewed-By: Ujjwal Sharma <usharma1998@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2019-08-15 17:31:01 +01:00
Anna Henningsen
ea5628e77a
process: allow reading from stdout/stderr sockets
...
Allow reading from stdio streams that are conventionally
associated with process output, since this is only convention.
This involves disabling the oddness around closing stdio
streams. Its purpose is to prevent the file descriptors
0 through 2 from being closed, since doing so can lead
to information leaks when new file descriptors are being
opened; instead, not doing anything seems like a more
reasonable choice.
Fixes: https://github.com/nodejs/node/issues/21203
Backport-PR-URL: https://github.com/nodejs/node/pull/25351
PR-URL: https://github.com/nodejs/node/pull/23053
Reviewed-By: James M Snell <jasnell@gmail.com >
2019-03-19 22:55:13 +00:00
Gerhard Stoebich
4c24a82a65
http2: fix sequence of error/close events
...
Correct sequence of emitting `error` and `close` events for a
`Http2Stream`.
PR-URL: https://github.com/nodejs/node/pull/24789
Refs: https://github.com/nodejs/node/pull/22850
Refs: https://github.com/nodejs/node/pull/24685
Fixes: https://github.com/nodejs/node/issues/24559
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
2018-12-11 16:28:47 +00:00
Matteo Collina
696f063c5e
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/151
Ref: 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-27 15:07:09 +11:00
cjihrig
0187e3bef8
process: avoid using the same fd for ipc and stdio
...
There is already a check in place to prevent stdin and the IPC
channel from sharing a file descriptor. This commit adds a
similar check to stdout and stderr.
Backport-PR-URL: https://github.com/nodejs/node/pull/24103
Refs: https://github.com/libuv/libuv/pull/1851
Refs: https://github.com/libuv/libuv/issues/1897
PR-URL: https://github.com/nodejs/node/pull/21466
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2018-11-11 15:07:29 +01:00
Bastian Krol
26d145a77f
async_hooks: add missing async_hooks destroys in AsyncReset
...
This adds missing async_hooks destroy calls for sockets (in
_http_agent.js) and HTTP parsers. We need to emit a destroy in
AsyncWrap#AsyncReset before assigning a new async_id when the instance
has already been in use and is being recycled, because in that case, we
have already emitted an init for the "old" async_id.
This also removes a duplicated init call for HTTP parser: Each time a
new parser was created, AsyncReset was being called via the C++ Parser
class constructor (super constructor AsyncWrap) and also via
Parser::Reinitialize.
Backport-PR-URL: https://github.com/nodejs/node/pull/23410
PR-URL: https://github.com/nodejs/node/pull/23272
Fixes: https://github.com/nodejs/node/issues/19859
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: James M Snell <jasnell@gmail.com >
2018-11-04 12:35:10 +00:00
Ruben Bridgewater
a42d0726ac
assert: use object argument in innerFail
...
Right now it is difficult to know what argument stands for what
property. By refactoring the arguments into a object it is clear
what stands for what.
Backport-PR-URL: https://github.com/nodejs/node/pull/23223
PR-URL: https://github.com/nodejs/node/pull/17582
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Jon Moss <me@jonathanmoss.me >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com >
2018-10-31 13:45:00 -04:00
James M Snell
10576d6e77
http2: add ping event
...
Add a `Http2Session` event whenever a non-ack `PING` is received.
Fixes: https://github.com/nodejs/node/issues/18514
Backport-PR-URL: https://github.com/nodejs/node/pull/22850
PR-URL: https://github.com/nodejs/node/pull/23009
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Ujjwal Sharma <usharma1998@gmail.com >
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com >
Reviewed-By: Denys Otrishko <shishugi@gmail.com >
2018-10-17 00:07:24 +01:00
Anatoli Papirovski
ca933ce577
http2: do not falsely emit 'aborted' on push
...
A push stream should have its writable side closed upon receipt,
to avoid emitting the 'aborted' event when the readable side
is closed.
Backport-PR-URL: https://github.com/nodejs/node/pull/22850
PR-URL: https://github.com/nodejs/node/pull/22878
Fixes: https://github.com/nodejs/node/issues/22851
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2018-10-17 00:07:24 +01:00
James M Snell
49f44f3b44
http2: add origin frame support
...
v8.x Backport Note -- as V8 doesn't expose an overload of String::WriteOneByte
in Node 8 that accepts an isolate argument, the Origins constructor has been
changed to not accept an isolate.
Backport-PR-URL: https://github.com/nodejs/node/pull/22850
PR-URL: https://github.com/nodejs/node/pull/22956
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2018-10-17 00:07:24 +01:00
Matteo Collina
9f7934159e
http2: check if stream is not destroyed before sending trailers
...
Fixes: https://github.com/nodejs/node/issues/22855
Backport-PR-URL: https://github.com/nodejs/node/pull/22850
PR-URL: https://github.com/nodejs/node/pull/22896
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2018-10-17 00:07:24 +01:00
James M Snell
2de17ead89
http2: add http2stream.endAfterHeaders property
...
Indicates is the END_STREAM flag was set on the received HEADERS frame
Backport-PR-URL: https://github.com/nodejs/node/pull/22850
PR-URL: https://github.com/nodejs/node/pull/22843
Fixes: https://github.com/nodejs/node/issues/22497
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
2018-10-17 00:07:24 +01:00
Szymon Marczak
805bf40bfd
http2: don't expose the original socket through the socket proxy
...
Refs: https://github.com/nodejs/node/pull/22486
Backport-PR-URL: https://github.com/nodejs/node/pull/22850
PR-URL: https://github.com/nodejs/node/pull/22650
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2018-10-17 00:07:24 +01:00
James M Snell
6a396ff911
http2: throw better error when accessing unbound socket proxy
...
Fixes: https://github.com/nodejs/node/issues/22268
Backport-PR-URL: https://github.com/nodejs/node/pull/22850
PR-URL: https://github.com/nodejs/node/pull/22486
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2018-10-17 00:07:24 +01:00
James M Snell
348cde07fd
http2: emit timeout on compat request and response
...
v8.x Backport Note: The timeout has been increased to 10ms.
Fixes: https://github.com/nodejs/node/issues/20079
Backport-PR-URL: https://github.com/nodejs/node/pull/22850
PR-URL: https://github.com/nodejs/node/pull/22252
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
2018-10-17 00:07:24 +01:00
James M Snell
cc561cc5a7
http2: explicitly disallow nested push streams
...
Fixes: https://github.com/nodejs/node/issues/19095
Backport-PR-URL: https://github.com/nodejs/node/pull/22850
PR-URL: https://github.com/nodejs/node/pull/22245
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
2018-10-17 00:07:24 +01:00
James M Snell
f2f66b4cfb
http2: remove streamError from docs
...
`streamError` was removed quite some time ago but the docs and
code comments weren't updated. Fix that.
Fixes: https://github.com/nodejs/node/issues/20211
Backport-PR-URL: https://github.com/nodejs/node/pull/22850
PR-URL: https://github.com/nodejs/node/pull/22246
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Jon Moss <me@jonathanmoss.me >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
2018-10-17 00:07:24 +01:00
James Ide
d602c7a2ed
http2: release request()'s "connect" event listener after it runs
...
The `Http2Session#request()` method internally listens to the "connect"
event if the session has not yet established a connection so that the
actual request can be sent after the connection has been established.
This commit removes the event listener after it runs and carries out
the request and is no longer needed. In practice this shouldn't affect
the behavior of the session object since the "connect" event fires only
once anyway, but removing the listener releases its references. The
rest of this class subscribes to the "connect" event with `once`
instead of `on` as well.
Tested by adding a new test that ensures `Http2Session#request()` is
called before the connection is established, indicated by a "connect"
listener that is run. The test also ensures all "connect" listeners are
removed after the connection is established.
Backport-PR-URL: https://github.com/nodejs/node/pull/22850
PR-URL: https://github.com/nodejs/node/pull/21916
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2018-10-17 00:07:24 +01:00
RidgeA
e5175e6596
http2: remove waitTrailers listener after closing a stream
...
When `writeHeader` of `Http2ServerResponse` instance are called with
204, 205 and 304 status codes an underlying stream closes.
If call `end` method after sending any of these status codes it will
cause an error `TypeError: Cannot read property 'Symbol(trailers)' of
undefined` because a reference to `Http2ServerResponse` instance
associated with Http2Stream already was deleted.
The closing of stream causes emitting `waitTrailers` event and, when
this event handles inside `onStreamTrailerReady` handler, there is
no reference to Http2ServerResponse instance.
Fixes: https://github.com/nodejs/node/issues/21740
Backport-PR-URL: https://github.com/nodejs/node/pull/22850
PR-URL: https://github.com/nodejs/node/pull/21764
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com >
2018-10-17 00:07:24 +01:00
Shailesh Shekhawat
57618aae0a
errors: fix undefined HTTP2 and tls errors
...
Includes implementation of tls, HTTP2 error with documentation.
Backport-PR-URL: https://github.com/nodejs/node/pull/22850
PR-URL: https://github.com/nodejs/node/pull/21564
Refs: https://github.com/nodejs/node/issues/21440
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com >
2018-10-17 00:07:24 +01:00
Rich Trott
071a022dbc
http2: order declarations in core.js
...
Order declarations:
* public modules in alphabetical order
* internal modules in alphabetical order
* process.binding() calls in alphabetical order
* exports in alphabetical order
Backport-PR-URL: https://github.com/nodejs/node/pull/22850
PR-URL: https://github.com/nodejs/node/pull/21689
Reviewed-By: Gus Caplan <me@gus.host >
Reviewed-By: Weijia Wang <starkwang@126.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2018-10-17 00:07:24 +01:00
Gerhard Stoebich
1cdf93ecdc
http2: pass incoming set-cookie header as array
...
Incoming set-cookie headers should be passed to user as array like in
http module.
Besides improving compatibility between http and http2 it avoids the
need to check if the type is an array or not in user code.
Backport-PR-URL: https://github.com/nodejs/node/pull/22850
PR-URL: https://github.com/nodejs/node/pull/21360
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com >
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2018-10-17 00:07:24 +01:00
Anatoli Papirovski
3c8c53f4f4
http2: fix premature destroy
...
Check stream._writableState.finished instead of stream.writable
as the latter can lead to premature calls to destroy and dropped
writes on busy processes.
Backport-PR-URL: https://github.com/nodejs/node/pull/22850
PR-URL: https://github.com/nodejs/node/pull/21051
Fixes: https://github.com/nodejs/node/issues/20750
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: James M Snell <jasnell@gmail.com >
2018-10-17 00:07:24 +01:00
Anatoli Papirovski
b22266cc97
http2: force through RST_STREAM in destroy
...
If still needed, force through RST_STREAM in Http2Stream#destroy
calls, so that nghttp2 can wrap up properly and doesn't continue
trying to read & write data to the stream.
Backport-PR-URL: https://github.com/nodejs/node/pull/22850
PR-URL: https://github.com/nodejs/node/pull/21016
Fixes: https://github.com/nodejs/node/issues/21008
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
2018-10-17 00:07:24 +01:00
Anatoli Papirovski
91be1dc2a5
http2: delay closing stream
...
Delay automatically closing the stream with setImmediate in order
to allow any pushStreams to be sent first.
Backport-PR-URL: https://github.com/nodejs/node/pull/22850
PR-URL: https://github.com/nodejs/node/pull/20997
Fixes: https://github.com/nodejs/node/issues/20992
Reviewed-By: James M Snell <jasnell@gmail.com >
2018-10-17 00:07:24 +01:00
Anatoli Papirovski
0a6672fbcf
http2: fix several serious bugs
...
Currently http2 does not properly submit GOAWAY frames when a session
is being destroyed. It also doesn't properly handle when the other
party severs the connection after sending a GOAWAY frame, even though
it should.
Edge, IE & Safari are currently unable to handle empty TRAILERS
frames despite them being correctly to spec. Instead send an empty
DATA frame with END_STREAM flag in those situations.
Fix and adjust several flaky and/or incorrect tests.
Backport-PR-URL: https://github.com/nodejs/node/pull/22850
PR-URL: https://github.com/nodejs/node/pull/20772
Fixes: https://github.com/nodejs/node/issues/20705
Fixes: https://github.com/nodejs/node/issues/20750
Fixes: https://github.com/nodejs/node/issues/20850
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2018-10-17 00:07:24 +01:00
Ujjwal Sharma
b0e3ce9c4b
net,http2: refactor _write and _writev
...
Refactor writable part (the _write and _writev functions) in net.Socket
and http2.Http2Stream classes.
Also involves adding a generic "WriteGeneric" method to the Http2Stream
class based on net.Socket._writeGeneric, but behind a symbol.
Backport-PR-URL: https://github.com/nodejs/node/pull/22850
PR-URL: https://github.com/nodejs/node/pull/20643
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
2018-10-17 00:07:24 +01:00
Anatoli Papirovski
b0c92cadfa
http2: fix end without read
...
Adjust http2 behaviour to allow ending a stream even after some
data comes in (when the user has no intention of reading that
data). Also correctly end a stream when trailers are present.
Backport-PR-URL: https://github.com/nodejs/node/pull/22850
PR-URL: https://github.com/nodejs/node/pull/20621
Fixes: https://github.com/nodejs/node/issues/20060
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
2018-10-17 00:07:24 +01:00
Robert Nagy
d1b78252b1
http2: avoid bind and properly clean up in compat
...
Backport-PR-URL: https://github.com/nodejs/node/pull/22850
PR-URL: https://github.com/nodejs/node/pull/20374
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
2018-10-17 00:07:24 +01:00
Daniel Bevenius
74192ddb66
http2: reduce require calls in http2/core
...
This commit removes unnecesary requires of http and internal/util in
http2/core.js
Backport-PR-URL: https://github.com/nodejs/node/pull/22850
PR-URL: https://github.com/nodejs/node/pull/20422
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com >
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
2018-10-17 00:07:24 +01:00
Ruben Bridgewater
28a6e59bd3
http2: fix ping callback
...
In case there was no ack, the callback would have returned
more than the error as return value. This makes sure that is not
the case anymore.
Backport-PR-URL: https://github.com/nodejs/node/pull/22850
PR-URL: https://github.com/nodejs/node/pull/20311
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
2018-10-17 00:07:24 +01:00
Anatoli Papirovski
41dca9e851
http2: fix responses to long payload reqs
...
When a request with a long payload is received, http2 does
not allow a response that does not process all the incoming
payload. Add a conditional Http2Stream.close call that runs
only if the user hasn't attempted to read the stream.
Backport-PR-URL: https://github.com/nodejs/node/pull/22850
PR-URL: https://github.com/nodejs/node/pull/20084
Fixes: https://github.com/nodejs/node/issues/20060
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2018-10-17 00:07:24 +01:00
Robert Nagy
1edd7f6393
http: added aborted property to request
...
Backport-PR-URL: https://github.com/nodejs/node/pull/22850
PR-URL: https://github.com/nodejs/node/pull/20094
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2018-10-17 00:07:24 +01:00
James M Snell
fa5a3809a3
http2: refactor how trailers are done
...
Rather than an option, introduce a method and an event...
```js
server.on('stream', (stream) => {
stream.respond(undefined, { waitForTrailers: true });
stream.on('wantTrailers', () => {
stream.sendTrailers({ abc: 'xyz'});
});
stream.end('hello world');
});
```
This is a breaking change in the API such that the prior
`options.getTrailers` is no longer supported at all.
Ordinarily this would be semver-major and require a
deprecation but the http2 stuff is still experimental.
Backport-PR-URL: https://github.com/nodejs/node/pull/22850
PR-URL: https://github.com/nodejs/node/pull/19959
Reviewed-By: Yuta Hiroto <hello@hiroppy.me >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2018-10-17 00:07:24 +01:00
cjihrig
2ae98ce7cb
lib: define printErr() in script string
...
This commit moves the printErr() function, used by the
tick profiler processer, into the code string passed to
vm.runInThisContext().
PR-URL: https://github.com/nodejs/node/pull/19285
Fixes: https://github.com/nodejs/node/issues/19260
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Gus Caplan <me@gus.host >
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
2018-09-13 10:49:32 +02:00
Robert Rossmann
711098e88c
process: Send signal name to signal handlers
...
Backport-PR-URL: https://github.com/nodejs/node/pull/22380
PR-URL: https://github.com/nodejs/node/pull/15606
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: Evan Lucas <evanlucas@me.com >
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com >
Reviewed-By: Bartosz Sosnowski <bartosz@janeasystems.com >
2018-09-06 09:40:48 -07:00
sylkat
d478bc7375
src: fix bootstrap_node on bsd
...
Currently makes a call to `realpathSync.native` which doesn't exist
on 8.x or lower
PR-URL: https://github.com/nodejs/node/pull/22663
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Myles Borins <myles.borins@gmail.com >
2018-09-03 10:23:05 -04:00
Gus Caplan
4df93dc8ac
tools,bootstrap: preprocess gypi files to json
...
PR-URL: https://github.com/nodejs/node/pull/19140
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
2018-08-17 15:30:01 -04:00
Daniel Bevenius
cf833e4901
lib: change hook -> hooks in code comment
...
PR-URL: https://github.com/nodejs/node/pull/19053
Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Richard Lau <riclau@uk.ibm.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
2018-08-17 15:22:32 -04:00
Anna Henningsen
2ec981b078
process: use more direct sync I/O for stdio
...
This avoids routing writes through the full LibuvStreamWrap
write machinery. In particular, it enables the next commit,
because otherwise the callback passed to `_write()`
would not be called synchronously for pipes on Windows
(because the latter does not support `uv_try_write()`,
even for blocking I/O).
PR-URL: https://github.com/nodejs/node/pull/18019
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com >
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
2018-08-17 14:57:32 -04:00
Sarat Addepalli
e25d5d077d
fs: support as and as+ flags in stringToFlags()
...
PR-URL: https://github.com/nodejs/node/pull/18801
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: Matheus Marchini <matheus@sthima.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
2018-08-16 01:59:10 -04:00
killagu
c4716dc711
tools, test: fix prof polyfill readline
...
`node --prof foo.js` may not print the full profile log file, leaving
the last line broken (for example `tick,`. When that happens, `readline`
will be stuck in an infinite loop. This patch fixes it.
Also introduced `common.isCPPSymbolsNotMapped` to avoid duplicated code
on tick-processor tests.
Backport-PR-URL: https://github.com/nodejs/node/pull/18901
PR-URL: https://github.com/nodejs/node/pull/18641
Reviewed-By: Khaidi Chu <i@2333.moe >
Reviewed-By: Matheus Marchini <matheus@sthima.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
2018-08-16 11:38:53 +10:00
Santiago Gimeno
1d90700514
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:
https://github.com/libuv/libuv/commit/fd049399aa4ed8495928e375466970d98cb42e17 .
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-08-16 11:38:53 +10:00
cjihrig
dc000a55d3
cluster: add cwd to cluster.settings
...
This commit allows cluster workers to be created with
configurable working directories.
Fixes: https://github.com/nodejs/node/issues/16388
PR-URL: https://github.com/nodejs/node/pull/18399
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2018-08-16 11:38:52 +10:00
Todd Wong
76805f0043
cluster: support windowsHide option for workers
...
Fixes: https://github.com/nodejs/node/issues/17370
PR-URL: https://github.com/nodejs/node/pull/17412
Fixes: https://github.com/nodejs/node/issues/17370
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: James M Snell <jasnell@gmail.com >
2018-08-16 11:38:52 +10:00
James M Snell
54ea1ccf2d
src: refactor bootstrap to use bootstrap object
...
Backport-PR-URL: https://github.com/nodejs/node/pull/21798
PR-URL: https://github.com/nodejs/node/pull/20917
Reviewed-By: Gus Caplan <me@gus.host >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: Refael Ackermann <refack@gmail.com >
2018-08-16 11:38:52 +10:00