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
Сковорода Никита Андреевич
2116ace0ad
doc: fix http2stream.pushStream error doc
...
The old error code `ERR_HTTP2_STREAM_CLOSED` was removed in commit
0babd181a0 (pull request #17406 ), and the
testcase for http2stream.pushStream was changed accordingly, but the
documentation change was overlooked.
This commit fixes it and aligns the documentation with the testcase.
This is a part of the fixes hinted by #21470 , which includes some tests
for error codes usage and documentation and enforces a stricter format.
Refs: https://github.com/nodejs/node/pull/21470
Refs: https://github.com/nodejs/node/pull/17406
Backport-PR-URL: https://github.com/nodejs/node/pull/22850
PR-URL: https://github.com/nodejs/node/pull/21487
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@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
Gerhard Stoebich
4228141012
doc: Improve doc for Http2 headers object
...
Add more details regarding processing and data type of incoming
headers in Http2.
Backport-PR-URL: https://github.com/nodejs/node/pull/22850
PR-URL: https://github.com/nodejs/node/pull/21296
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Ujjwal Sharma <usharma1998@gmail.com >
2018-10-17 00:07:24 +01:00
Anna Henningsen
20b72fc94d
http2: track memory allocated by nghttp2
...
Provide a custom memory allocator for nghttp2, and track
memory allocated by the library with it.
This makes the used-memory-per-session estimate more
accurate, and allows us to track memory leaks either
in nghttp2 itself or, more likely, through faulty
usage on our end.
It also allows us to make the per-session memory limit
more accurate in the future; currently, we are not
handling this in an ideal way, and instead let nghttp2
allocate what it wants, even if that goes over our limit.
Backport-PR-URL: https://github.com/nodejs/node/pull/22850
PR-URL: https://github.com/nodejs/node/pull/21374
Refs: https://github.com/nodejs/node/pull/21373
Refs: https://github.com/nodejs/node/pull/21336
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com >
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com >
2018-10-17 00:07:24 +01:00
Anna Henningsen
e9e4f434b3
http2: fix memory leak when headers are not emitted
...
When headers are not emitted to JS, e.g. because of an error
before that could happen, we currently still have the vector of
previously received headers lying around, each one holding
a reference count of 1.
To fix the resulting memory leak, release them in the `Http2Stream`
destructor.
Also, clear the vector of headers once they have been emitted –
there’s not need to keep it around, wasting memory.
Backport-PR-URL: https://github.com/nodejs/node/pull/22850
PR-URL: https://github.com/nodejs/node/pull/21373
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com >
2018-10-17 00:07:24 +01:00
Anna Henningsen
0f3e65099d
http2: fix memory leak for uncommon headers
...
Fix a memory leak that occurs with header names that are
short and not present in the static table of default headers.
Backport-PR-URL: https://github.com/nodejs/node/pull/22850
PR-URL: https://github.com/nodejs/node/pull/21336
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Minwoo Jung <minwoo@nodesource.com >
Reviewed-By: Richard Lau <riclau@uk.ibm.com >
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com >
2018-10-17 00:07:24 +01:00
Anatoli Papirovski
0a8d0861f2
http2: safer Http2Session destructor
...
It's hypothetically (and with certain V8 flags) possible for the session
to be garbage collected before all the streams are. In that case, trying
to remove the stream from the session will lead to a segfault due to
attempting to access no longer valid memory. Fix this by unsetting the
session on any streams still around when destroying.
Backport-PR-URL: https://github.com/nodejs/node/pull/22850
PR-URL: https://github.com/nodejs/node/pull/21194
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Ujjwal Sharma <usharma1998@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
Anna Henningsen
322f39d490
test: minor adjustments to test-http2-respond-file
...
Backport-PR-URL: https://github.com/nodejs/node/pull/22850
PR-URL: https://github.com/nodejs/node/pull/21098
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Jon Moss <me@jonathanmoss.me >
Reviewed-By: Richard Lau <riclau@uk.ibm.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
5d29e2c631
test: fix flaky http2-session-unref
...
It's possible for the connections to take too long and since the server
is already unrefed, the process will just exit. Instead adjust the test
so that server unref only happens after all sessions have been
successfuly established and unrefed. That still tests the same condition
but will not fail under load.
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
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
Keita Akutsu
11a63ddf48
doc: fix typo in http2.md
...
Backport-PR-URL: https://github.com/nodejs/node/pull/22850
PR-URL: https://github.com/nodejs/node/pull/20843
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
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
Rich Trott
e5f8b08305
test: improve reliability of http2-session-timeout
...
Check actual expired time rather than relying on a number of calls to
setTimeout() in test-http2-session-timeout more robust.
Backport-PR-URL: https://github.com/nodejs/node/pull/22850
PR-URL: https://github.com/nodejs/node/pull/20692
Fixes: https://github.com/nodejs/node/issues/20628
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: James M Snell <jasnell@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
Ujjwal Sharma
4f0035485f
doc: add parameters for Http2Stream:error event
...
Add parameters for the callback for the Http2Stream:error event
inline with the pattern in the rest of the documentation.
Refs: https://github.com/nodejs/help/issues/877#issuecomment-381253464
Backport-PR-URL: https://github.com/nodejs/node/pull/22850
PR-URL: https://github.com/nodejs/node/pull/20610
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
2018-10-17 00:07:24 +01:00
Ujjwal Sharma
77acef4af2
doc: add params for ClientHttp2Session:altsvc
...
Add parameters for the callback for the ClientHttp2Session:altsvc
event inline with the pattern in the rest of the documentation.
Refs: https://github.com/nodejs/help/issues/877#issuecomment-381253464
Backport-PR-URL: https://github.com/nodejs/node/pull/22850
PR-URL: https://github.com/nodejs/node/pull/20598
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
2018-10-17 00:07:24 +01:00
Anatoli Papirovski
c30a8f468d
test: fix flaky http2-flow-control test
...
Backport-PR-URL: https://github.com/nodejs/node/pull/22850
PR-URL: https://github.com/nodejs/node/pull/20556
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
Ujjwal Sharma
448922d0de
doc: add parameters for Http2Session:stream event
...
Add parameters for the callback for the Http2Session:stream event
inline with the pattern in the rest of the documentation.
Refs: https://github.com/nodejs/help/issues/877#issuecomment-381253464
Backport-PR-URL: https://github.com/nodejs/node/pull/22850
PR-URL: https://github.com/nodejs/node/pull/20547
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@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
Daniel Bevenius
395ce845da
http2: rename http2_state class to Http2State
...
This commit renames the http2_state class to follow the guidelines in
CPP_STYLE_GUIDE.md.
Backport-PR-URL: https://github.com/nodejs/node/pull/22850
PR-URL: https://github.com/nodejs/node/pull/20423
Reviewed-By: Anna Henningsen <anna@addaleax.net >
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
Ujjwal Sharma
41e89316e6
doc: add parameters for settings events
...
Add parameters for the callback for the Http2Session:localSettings event
and Http2Session:remoteSettings event inline with the pattern in the
rest of the documentation.
Refs: https://github.com/nodejs/help/issues/877#issuecomment-381253464
Backport-PR-URL: https://github.com/nodejs/node/pull/22850
PR-URL: https://github.com/nodejs/node/pull/20371
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
2018-10-17 00:07:24 +01:00
Ruben Bridgewater
aa341d1d3d
test: verify arguments length in common.expectsError
...
If `common.expectsError` is used as a callback, it will now also
verify that there is only one argument (the expected error).
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
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
Ujjwal Sharma
1a6a054899
doc: improve parameters for Http2Session:goaway event
...
Improve parameters for the callback for the Http2Session:connect event
inline with the pattern in the rest of the documentation.
Refs: https://github.com/nodejs/help/issues/877#issuecomment-381253464
Backport-PR-URL: https://github.com/nodejs/node/pull/22850
2018-10-17 00:07:24 +01:00
kailash k yogeshwar
c7ba556264
test: removed assert.strictEqual message
...
Backport-PR-URL: https://github.com/nodejs/node/pull/22850
PR-URL: https://github.com/nodejs/node/pull/20223
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
Reviewed-By: Rich Trott <rtrott@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
Ujjwal Sharma
98ed30f3f5
doc: improve docs for Http2Session:frameError
...
Improve documentation regarding the callback parameters for the
frameError event for instances of Http2Session, making it inline with
the currently accepted structure, like the rest of the documentation.
Refs: https://github.com/nodejs/help/issues/877#issuecomment-381253464
Backport-PR-URL: https://github.com/nodejs/node/pull/22850
PR-URL: https://github.com/nodejs/node/pull/20236
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
2018-10-17 00:07:24 +01:00
Ujjwal Sharma
b32cf8fa40
doc: add parameters for Http2Session:error event
...
Add parameters for the callback for the Http2Session:error event
inline with the pattern in the rest of the documentation.
Refs: https://github.com/nodejs/help/issues/877#issuecomment-381253464
Backport-PR-URL: https://github.com/nodejs/node/pull/22850
PR-URL: https://github.com/nodejs/node/pull/20206
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@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
Christine E. Taylor
5abe246a44
test: add strictEqual method to assert
...
Adds strictEqual method to assert on stream.session.alpnProtocol
to verify expected value 'h2'. This changes 'h2' from an assertion
error message to the value expected from stream.session.alpnProtocol.
Backport-PR-URL: https://github.com/nodejs/node/pull/22850
PR-URL: https://github.com/nodejs/node/pull/20189
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Richard Lau <riclau@uk.ibm.com >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
2018-10-17 00:07:24 +01:00
Ujjwal Sharma
af5cebb326
doc,http2: add parameters for Http2Session:connect event
...
Add parameters for the callback for the Http2Session:connect event
inline with the pattern in the rest of the documentation.
Refs: https://github.com/nodejs/help/issues/877#issuecomment-381253464
Backport-PR-URL: https://github.com/nodejs/node/pull/22850
PR-URL: https://github.com/nodejs/node/pull/20193
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com >
2018-10-17 00:07:24 +01:00
Bryan Azofeifa
887417eb37
test: remove message from strictEqual assertions
...
When an AssertionError happens, the value of headers['set-cookie']
is not reported. That information is useful for debugging.
Hence removed the value passed as the message in deepStrictEqual
assertions of test/parallel/test-http2-cookies.js
Backport-PR-URL: https://github.com/nodejs/node/pull/22850
PR-URL: https://github.com/nodejs/node/pull/20174
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Richard Lau <riclau@uk.ibm.com >
Reviewed-By: Trivikram Kamat <trivikr.dev@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
Indranil Dasgupta
c0d1423bd3
doc: close event does not take arguments
...
Explicitly added in the docs that the close event does not expect
any arguments when invoked.
Fixes: https://github.com/nodejs/node/issues/20018
Backport-PR-URL: https://github.com/nodejs/node/pull/22850
PR-URL: https://github.com/nodejs/node/pull/20031
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2018-10-17 00:07:24 +01:00
James M Snell
5862d0372c
http2: fix ping duration calculation
...
Backport-PR-URL: https://github.com/nodejs/node/pull/22850
PR-URL: https://github.com/nodejs/node/pull/19956
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
2018-10-17 00:07:24 +01:00
Ujjwal Sharma
fe3836a871
test: delete test/parallel/test-regress-GH-4948
...
Refs: https://github.com/nodejs/node/pull/19275#issuecomment-372101538
2018-10-16 22:34:16 +01:00
Rich Trott
459690aca4
doc: improve style guide text
...
* Specify that personal pronouns are OK in colloquial documentation
rather than just pronouns. Pronouns are OK in all documentation. (For
example, "it" is a pronoun and is acceptable in all types of
documentation.) Specify "personal pronouns" for clarity.
* more colloquial -> colloquial
* like -> such as
* Remove "mass nouns" as no mass nouns are given as examples. Plural
nouns seems to be what was meant, so use that instead.
* Repeat "gender-neutral" to make it clear that it refers to both terms
and not merely the first term it appears before.
* Remove "non-comprehensive examples". Examples are, by definition,
non-comprehensive. No need to announce that the examples are examples.
It is obvious.
PR-URL: https://github.com/nodejs/node/pull/19269
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2018-10-16 22:17:48 +01:00
Rich Trott
4bcdc1b83c
test: fix assertion argument order
...
Fix the assertion argument order so that it will report "actual" and
"expected" correctly when the test fails.
Ref: https://github.com/nodejs/node/issues/19263
PR-URL: https://github.com/nodejs/node/pull/19264
Refs: https://github.com/nodejs/node/issues/19263
Reviewed-By: Richard Lau <riclau@uk.ibm.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
2018-10-16 21:25:51 +01:00
Ben Noordhuis
b67bf38f31
src: fix fs.write() externalized string handling
...
* Respect `encoding` argument when the string is externalized.
* Copy the string when the write request can outlive the externalized
string.
This commit removes `StringBytes::GetExternalParts()` because it is
fundamentally broken.
Fixes: https://github.com/nodejs/node/issues/18146
Fixes: https://github.com/nodejs/node/issues/22728
Backport-PR-URL: https://github.com/nodejs/node/pull/22731
PR-URL: https://github.com/nodejs/node/pull/18216
Reviewed-By: James M Snell <jasnell@gmail.com >
2018-10-16 16:27:59 +01:00
Ben Noordhuis
ca8d4e3450
build: define NOMINMAX on windows
...
Build with `-DNOMINMAX` to stop `<windows.h>` from defining macros that
conflict with `std::min()` and `std::max()`.
Backport-PR-URL: https://github.com/nodejs/node/pull/22731
PR-URL: https://github.com/nodejs/node/pull/18216
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
PR-URL: https://github.com/nodejs/node/pull/22731
2018-10-16 16:26:48 +01:00
Peter Marshall
48f31bdf20
deps: V8: backport 20 CPU profiler commits from upstream
...
[cpu-profiler] Fix bugs and add tests for JITLineInfoTable
https://chromium.googlesource.com/v8/v8/+/4feb5ce7fd5ef8c933f3f5dff2eca1173f85c1e9
[cpu-profiler] Fix incorrect line number calculation.
https://chromium.googlesource.com/v8/v8/+/ddb2856f39632f9e9f623d3cdb4600e636172031
[cpu-profiler] Use std::unordered_map for hashmaps.
https://chromium.googlesource.com/v8/v8/+/35985ce6abc80b85264fe3b87b246fed5f1806e6
[cpu-profiler] Do not store CodeEntries between profiling sessions.
https://chromium.googlesource.com/v8/v8.git/+/8ec48b2117b8092c4956f1ee11a0c85bec3ba1f8
[cpu-profiler] Remove name_prefix field from CodeEntry
https://chromium.googlesource.com/v8/v8.git/+/6f72af25fe43218b60c68129073ddcddb631566e
[cpu-profiler] Extract rare used fields of CodeEntry to an optional object.
https://chromium.googlesource.com/v8/v8.git/+/fcc1ebb55aab38013855834f556f6e874e0eb8b3
[profiler] Refactoring: decouple StringsStorage from Heap object.
https://chromium.googlesource.com/v8/v8/+/a31320f59c911a277566d6c2fa0b0f2ac83e0748
[cpu-profiler] Add a HandleScope to limit memory consumption.
https://chromium.googlesource.com/v8/v8.git/+/3e9f8a4f635e2d946651d6a4df81378266f32dc9
[cpu-profiler] Lazily create CPU profiler.
https://chromium.googlesource.com/v8/v8/+/1426ea1d6d45be0b4d9476bdb5bf3f27cfe578a0
[cpu-profiler] turn several std::map's into unordered_map's.
https://chromium.googlesource.com/v8/v8/+/3ed5dfb8a3cbc7aa0017bd01c2fdd6227485b8ad
[cpu-profiler] Eagerly delete not used CodeEntry'es
https://chromium.googlesource.com/v8/v8.git/+/c6c28f7a412a88df12055e953630a9e93cc64d49
[cpu-profiler] Move bailout reason into rare_info struct
https://chromium.googlesource.com/v8/v8.git/+/29ea4d1ef5360e71c61ecf8db6a5a0a0c3391fd1
[cpu-profiler] Save space in the SourcePositionTable by using a vector.
https://chromium.googlesource.com/v8/v8.git/+/1cb19f0e0a93adbac8c11bc906f951bd8098722d
[cpu-profiler] Only store deopt inline frames for functions that need it
https://chromium.googlesource.com/v8/v8.git/+/0bfcbdd4726920755e51dab28c18ab93e050819b
[cpu-profiler] Add a new profiling mode with a more detailed call tree.
https://chromium.googlesource.com/v8/v8.git/+/ecae80cdb350dde1e654c531b56f5b6c44dc8c77
[cpu-profiler] Reuse free slots in code_entries_
https://chromium.googlesource.com/v8/v8.git/+/3e1126bf15e62c433c4e9cb21316d182f691c63a
[cpu-profiler] Use instruction start as the key for the CodeMap
https://chromium.googlesource.com/v8/v8.git/+/ba752ea4c50713dff1e94f45a79db3ba968a8d66
[cpu-profiler] Add flag to always generate accurate line info.
https://chromium.googlesource.com/v8/v8/+/56baf56790de439b3f69e887e94beb3b301ed77c
[cpu-profiler] Turn on detailed line info for optimized code
https://chromium.googlesource.com/v8/v8/+/84894ce6d2af7feb9e1f5574409355120887326c
[cpu-profiler] Separate the flags for generating extra line information
https://chromium.googlesource.com/v8/v8/+/30ff6719db441cc7ef220d449970cc169067e256
Backport-PR-URL: https://github.com/nodejs/node/pull/21558
PR-URL: https://github.com/nodejs/node/pull/21558
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Myles Borins <myles.borins@gmail.com >
Reviewed-By: Yang Guo <yangguo@chromium.org >
Reviewed-By: Rod Vagg <rod@vagg.org >
2018-10-12 14:44:22 -07:00
Ujjwal Sharma
534bc82578
test: name test files appropriately
...
Rename the tests appropriately alongside mentioning the subsystem.
Also, make a few basic changes to make sure the test conforms
to the standard test structure.
This renames:
- test-regress-GH-1531
- test-regress-GH-2245
- test-regress-GH-3238
- test-regress-GH-3542
- test-regress-GH-3739
- test-regress-GH-4256
PR-URL: https://github.com/nodejs/node/pull/19212
Refs: https://github.com/nodejs/node/issues/19105
Refs: https://github.com/nodejs/node/blob/master/doc/guides/writing-tests.md#test-structure
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: James M Snell <jasnell@gmail.com >
2018-10-02 16:38:44 +01:00
Rich Trott
eaabbf4ff0
doc: make caveat in stream.md more concise
...
PR-URL: https://github.com/nodejs/node/pull/19251
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2018-10-02 16:36:46 +01:00