James M Snell
0d50c7061c
http2: multiple style and performance updates
...
* move CHECK statements into DEBUG checks
* improve performance by removing branches
* Several if checks were left in while the code was being developed.
Now that the core API has stablized more, the checks are largely
unnecessary and can be removed, yielding a significant boost in
performance.
* refactor flow control for proper backpressure
* use std::queue for inbound headers
* use std::queue for outbound data
* remove now unnecessary FreeHeaders function
* expand comments and miscellaneous edits
* add a couple of misbehaving flow control tests
PR-URL: https://github.com/nodejs/node/pull/16239
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
2017-10-23 17:35:54 -04:00
Anatoli Papirovski
9aa5d494e6
http2: allow port 80 in http2.connect
...
Due to how WHATWG-URL parser works, port numbers are omitted if
they are the default port for a scheme. This meant that
http2.connect could not accept connections on port 80 with http
scheme. Fix this bug by detecting http: scheme and setting port
to 80.
PR-URL: https://github.com/nodejs/node/pull/16337
Fixes: https://github.com/nodejs/node/issues/14304
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
2017-10-23 17:35:53 -04:00
Anna Henningsen
63036a8d6d
http2: support generic Duplex streams
...
Support generic `Duplex` streams through using `StreamWrap`
on the server and client sides, and adding a `createConnection`
method option similar to what the HTTP/1 API provides.
Since HTTP2 is, as a protocol, independent of its underlying transport
layer, Node.js should not enforce any restrictions on what streams
its internals may use.
Ref: https://github.com/nodejs/node/issues/16256
PR-URL: https://github.com/nodejs/node/pull/16269
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2017-10-23 17:35:53 -04:00
Anatoli Papirovski
bc1ad81b4c
http2: small fixes to http2 core
...
A few small changes:
- fix debug statement location
- simplify conditional with returns
- consistent use of template strings
PR-URL: https://github.com/nodejs/node/pull/16327
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2017-10-23 17:35:50 -04:00
Anatoli Papirovski
bcb83f70ec
http2: remove unnecessary asserts in core
...
options.getTrailers & options.selectPadding will always be a
function by the time the code reaches the assert checks. And
even if not (which seems currently impossible), the assert
failure will be almost the same as calling something that is
not a function. The downside of leaving these is that typeof
checks are decently expensive.
PR-URL: https://github.com/nodejs/node/pull/16327
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2017-10-23 17:35:50 -04:00
Anatoli Papirovski
098cd90560
http2: cleanup access via Symbols in core
...
Minimize property access via Symbols by consistently creating
new constants for things that are retrieved multiple times
within a method or a function. Fix cases where existing
constants aren't used where appropriate.
PR-URL: https://github.com/nodejs/node/pull/16327
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2017-10-23 17:35:49 -04:00
Anatoli Papirovski
bf7c2a3b65
http2: slightly simplify stream destroy
...
PR-URL: https://github.com/nodejs/node/pull/16327
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2017-10-23 17:35:49 -04:00
Guy Bedford
598787d854
module: fix main resolution and not found updates
...
This simplifies the top-level load when ES modules are enabled
as we can entirely delegate the module resolver, which will hand
over to CommonJS where appropriate.
All not found errors are made consistent to throw during resolve
and have the MODULE_NOT_FOUND code.
Includes the test case from https://github.com/nodejs/node/pull/15736 .
Fixes: https://github.com/nodejs/node/issues/15732
PR-URL: https://github.com/nodejs/node/pull/16147
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
2017-10-23 17:23:01 -04:00
Anatoli Papirovski
509b3b81d6
tools: enable additional eslint rules
...
Enable additional rules that node either already adheres to
or it makes sense to do so going forward: for-direction,
accessor-pairs, no-lonely-if and symbol-description.
Fix all instances of no-lonely-if in lib & test and disable
accessor-pairs in test-util-inspect.
PR-URL: https://github.com/nodejs/node/pull/16243
Refs: https://eslint.org/docs/rules/for-direction
Refs: https://eslint.org/docs/rules/accessor-pairs
Refs: https://eslint.org/docs/rules/no-lonely-if
Refs: https://eslint.org/docs/rules/symbol-description
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com >
Reviewed-By: Refael Ackermann <refack@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
2017-10-23 17:21:11 -04:00
Trivikram Kamat
25ef372235
http2: simplify te header validation, add test
...
This simplifies validation of te header and adds a test case
in which array with two values is passed to param value in
isIllegalConnectionSpecificHeader
PR-URL: https://github.com/nodejs/node/pull/16246
Refs: https://github.com/nodejs/node/issues/14985
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com >
2017-10-23 17:18:18 -04:00
Andreas Madsen
c9715bb9c2
async_hooks: skip runtime checks when disabled
...
PR-URL: https://github.com/nodejs/node/pull/15454
Ref: https://github.com/nodejs/node/pull/14387
Ref: https://github.com/nodejs/node/pull/14722
Ref: https://github.com/nodejs/node/issues/14717
Ref: https://github.com/nodejs/node/issues/15448
Reviewed-By: Refael Ackermann <refack@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
2017-10-23 17:18:17 -04:00
John-David Dalton
939a580406
errors: make code and name properties settable
...
For internal errors, make `code` and `name` settable while keeping them
non-own properties by default.
Backport-PR-URL: https://github.com/nodejs/node/pull/16078
PR-URL: https://github.com/nodejs/node/pull/15694
Fixes: https://github.com/nodejs/node/issues/15658
Reviewed-By: Evan Lucas <evanlucas@me.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com >
2017-10-23 09:21:51 -05:00
Rich Trott
0bd2fd5627
errors: make properties mutable
...
Userland code can break if it depends on a mutable `code` property for
errors. Allow users to change the `code` property but do not propagate
changes to the error `name`.
Additionally, make `message` and `name` consistent with `Error` object
(non-enumerable). Test that `console.log()` and `.toString()` calls on
internal `Error` objects with mutated properties have analogous results
with the standard ECMAScript `Error` objects.
Backport-PR-URL: https://github.com/nodejs/node/pull/16078
PR-URL: https://github.com/nodejs/node/pull/15694
Fixes: https://github.com/nodejs/node/issues/15658
Reviewed-By: Evan Lucas <evanlucas@me.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com >
2017-10-23 09:21:39 -05:00
Timothy Gu
67aed7972d
lib: faster type checks for some types
...
Backport-PR-URL: https://github.com/nodejs/node/pull/16073
PR-URL: https://github.com/nodejs/node/pull/15663
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Benedikt Meurer <benedikt.meurer@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2017-10-23 09:10:04 -05:00
Timothy Gu
25c980332f
module: add inspector to builtinLibs
...
Backport-PR-URL: https://github.com/nodejs/node/pull/16071
PR-URL: https://github.com/nodejs/node/pull/15643
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Eugene Ostroukhov <eostroukhov@google.com >
Reviewed-By: Trevor Norris <trev.norris@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2017-10-23 09:05:41 -05:00
Guy Bedford
86082a4a74
module: allow loading files with % in the name
...
PR-URL: https://github.com/nodejs/node/pull/16128
Reviewed-By: Refael Ackermann <refack@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Bradley Meck <bradley.meck@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com >
2017-10-17 23:32:40 -07:00
Bradley Farias
7307e1d2cd
src: add internalBindings for binding isolation
...
This commit adds a method to internal/process that allows access to
bindings that are not intended to be used by user code. It has a
separate cache object and modlist in order to avoid collisions.
You can use NODE_MODULE_CONTEXT_AWARE_INTERNAL to register a C++
module as an internal.
PR-URL: https://github.com/nodejs/node/pull/15759
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Brian White <mscdex@mscdex.net >
Reviewed-By: Refael Ackermann <refack@gmail.com >
2017-10-17 23:27:32 -07:00
guybedford
7337a40491
module: resolve and instantiate loader pipeline hooks
...
This enables a --loader flag for Node, which can provide custom
"resolve" and "dynamicInstantiate" methods for custom ES module
loading.
In the process, module providers have been converted from classes
into functions and the module APIs have been made to pass URL strings
over objects.
PR-URL: https://github.com/nodejs/node/pull/15445
Reviewed-By: Bradley Farias <bradley.meck@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Timothy Gu <timothygu99@gmail.com >
2017-10-17 23:25:36 -07:00
Weijia Wang
6ff397db89
url: using util._extend for improving profermace
...
`Object.assign` is much slower than `util._extend` according to
the refs. This change is to convert the `Object.assign` to use
`util._extend` in url module for improving profermance.
PR-URL: https://github.com/nodejs/node/pull/16081
Refs: https://github.com/nodejs/CTC/issues/62
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Timothy Gu <timothygu99@gmail.com >
Reviewed-By: Refael Ackermann <refack@gmail.com >
Reviewed-By: Brian White <mscdex@mscdex.net >
2017-10-17 21:10:01 -07:00
Trivikram Kamat
f39c7926cf
test: http2 client destroy tests in one file
...
Refs: https://github.com/nodejs/node/pull/14985
Backport-PR-URL: https://github.com/nodejs/node/pull/16070
PR-URL: https://github.com/nodejs/node/pull/15749
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2017-10-11 02:05:46 -04:00
Anatoli Papirovski
10622c6331
http2: near full http1 compatibility, add tests
...
Extensive re-work of http1 compatibility layer based on tests in
express, on-finished and finalhandler. Fix handling of HEAD
method to match http1. Adjust write, end, etc. to call writeHead
as in http1 and as expected by user-land modules. Add socket
proxy that instead uses the Http2Stream for the vast majority of
socket interactions. Add and change tests to closer represent
http1 behaviour.
Refs: https://github.com/nodejs/node/pull/15633
Refs: https://github.com/expressjs/express/tree/master/test
Refs: https://github.com/jshttp/on-finished/blob/master/test/test.js
Refs: https://github.com/pillarjs/finalhandler/blob/master/test/test.js
PR-URL: https://github.com/nodejs/node/pull/15702
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2017-10-11 02:05:44 -04:00
James M Snell
078ee27f13
http2: refactor method arguments to avoid bools
...
PR-URL: https://github.com/nodejs/node/pull/15693
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com >
2017-10-11 02:05:38 -04:00
Trivikram Kamat
df271f4f00
http2: setting shuttingDown=true after validation
...
In shutdown(), shuttingDown was set to true before validating options.
If invalid options are passed, error was thrown and server remained in
shuttingDown state. This code change fixes it.
PR-URL: https://github.com/nodejs/node/pull/15676
Fixes: https://github.com/nodejs/node/issues/15666
Refs: https://github.com/nodejs/node/issues/14985
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
2017-10-11 02:05:34 -04:00
Anatoli Papirovski
a4a5bee933
http2: adjust error emit in core, add tests
...
Use the ability of nextTick and setImmediate to pass arguments
instead of creating closures or binding. Add tests that cover
the vast majority of error emits.
PR-URL: https://github.com/nodejs/node/pull/15586
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
2017-10-11 02:05:31 -04:00
Andreas Madsen
1bc0c1fb5f
async_hooks: consistent internal naming
...
PR-URL: https://github.com/nodejs/node/pull/15569
Reviewed-By: Refael Ackermann <refack@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: James M Snell <jasnell@gmail.com >
2017-10-03 14:03:15 -07:00
Anatoli Papirovski
68ec157be0
http2: fix compat stream read handling, add tests
...
Handle edge case where stream pause is called between resume being
called and actually evaluated. Other minor adjustments to avoid
various edge cases around stream events. Add new tests that cover
all changes.
Fixes: https://github.com/nodejs/node/issues/15491
PR-URL: https://github.com/nodejs/node/pull/15503
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2017-09-25 13:33:55 -07:00
Anatoli Papirovski
9fc8eddfdd
http2: remove unused onTimeout, add timeout tests
...
Remove unused onTimeout on Http2Session and Http2Stream because
the correct _onTimeout is already declared and in use. Expand
timeout tests to handle edge cases and additional arguments.
PR-URL: https://github.com/nodejs/node/pull/15539
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
2017-09-25 12:44:13 -07:00
Anatoli Papirovski
1691827b8c
http2: small fixes to compatibility layer
...
Expand argument validation through compat API, adjust behaviour
of response.end to not throw if stream already closed to match
http1, adjust behaviour of writeContinue to not throw if stream
already closed and other very small tweaks. Add tests for added
and fixed behaviour. Add tests for edge case behaviours of
setTimeout, createPushResponse, destroy, end and trailers.
PR-URL: https://github.com/nodejs/node/pull/15473
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Minwoo Jung <jmwsoft@gmail.com >
2017-09-25 12:26:56 -07:00
Jon Moss
0a8258b3de
errors: remove duplicate error definition
...
Also fixes error being (now!) properly thrown by alphabetize-errors.
also properly enable lint rule
Was not using proper magic comment syntax before!
-URL: https://github.com/nodejs/node/pull/15307
Reviewed-By: Myles Borins <myles.borins@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2017-09-25 12:13:37 -07:00
James M Snell
a14b252c5c
errors: eliminate circular dependency on assert
...
PR-URL: https://github.com/nodejs/node/pull/15002
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Refael Ackermann <refack@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
2017-09-25 11:57:36 -07:00
Jon Moss
2e0313865b
errors,tools: alphabetize-errors lint rule
...
To make sure errors in lib/internal/errors.js (are defined via `E`)
will stay in alphabetical order going forward.
PR-URL: https://github.com/nodejs/node/pull/15083
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com >
Reviewed-By: Refael Ackermann <refack@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
2017-09-25 11:36:45 -07:00
Ruben Bridgewater
4f7d9392e7
assert: improve AssertionError in case of "Errors"
...
Showing the stack trace in a error message obfuscates the actual
message and should not be visible therefore.
PR-URL: https://github.com/nodejs/node/pull/15025
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
2017-09-21 07:52:54 -07:00
Ruben Bridgewater
cf1fe762dc
lib: improve lazy requires
...
* internal/errors - assert should already be in place when calling any
of the message generating functions.
* No lazy load if not necessary.
* Replace function calls with `if`s.
PR-URL: https://github.com/nodejs/node/pull/14167
Reviewed-By: Refael Ackermann <refack@gmail.com >
Reviewed-By: Timothy Gu <timothygu99@gmail.com >
2017-09-21 07:52:52 -07:00
Eugene Ostroukhov
25692a985c
inspector: break in eval script
...
Fixes: https://github.com/nodejs/node/issues/14577
PR-URL: https://github.com/nodejs/node/pull/14581
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: James M Snell <jasnell@gmail.com >
2017-09-20 14:37:37 -07:00
Ruben Bridgewater
539445890b
util: add fast internal array join method
...
PR-URL: https://github.com/nodejs/node/pull/14881
Reviewed-By: Refael Ackermann <refack@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
2017-09-20 14:25:27 -07:00
Anatoli Papirovski
ba9012d4bc
http2: add tests for push stream error handling
...
Add tests that cover errors for wrong arguments, as well as
tests for error codes from nghttp2. Fix pushStream to emit
NGHTTP2_ERR_STREAM_ID_NOT_AVAILABLE on session rather than
stream.
PR-URL: https://github.com/nodejs/node/pull/15281
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2017-09-20 14:08:38 -07:00
Tobias Nießen
b58a2aae1b
errors: fix ERR_MODULE_RESOLUTION_LEGACY message
...
PR-URL: https://github.com/nodejs/node/pull/15290
Refs: https://github.com/nodejs/node/pull/14369
Reviewed-By: Bradley Farias <bradley.meck@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
2017-09-20 13:53:55 -07:00
James M Snell
91e96d8f08
lib,src: fix consistent spacing inside braces
...
PR-URL: #14162
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com >
Reviewed-By: Refael Ackermann <refack@gmail.com >
Reviewed-By: Timothy Gu <timothygu99@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2017-09-20 12:32:17 -07:00
Anatoli Papirovski
b61220ed84
http2: fix subsequent end calls to not throw
...
Calling Http2ServerResponse.end multiple times should never
cause the code to throw an error, subsequent calls should
instead return false. Fix behaviour to match http1.
Fixes: https://github.com/nodejs/node/issues/15385
PR-URL: https://github.com/nodejs/node/pull/15414
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2017-09-20 09:32:46 -07:00
Anatoli Papirovski
2e421ff5c9
http2: correct behaviour for enablePush unpack
...
The only valid values for enablePush are 0 and 1. If validation
is requested, we should verify that it wasn't set to another
value rather than casting to Boolean regardless of value.
PR-URL: https://github.com/nodejs/node/pull/15167
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
2017-09-20 09:32:44 -07:00
Anatoli Papirovski
9490be353e
http2: cleanup of h2 compat layer, add tests
...
Remove unnecessary variable assignments, remove unreachable code
pathways, remove path getter and setter, and other very minor
cleanup. Only remove reference to stream on nextTick so that
users and libraries can access it in the finish event.
Fixes: https://github.com/nodejs/node/issues/15313
Refs: https://github.com/expressjs/express/pull/3390
PR-URL: https://github.com/nodejs/node/pull/15254
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2017-09-20 09:32:41 -07:00
James M Snell
aa0917cd0a
http2: improve http2 coverage
...
Improve http2 coverage through refactoring and tests
PR-URL: https://github.com/nodejs/node/pull/15210
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2017-09-20 09:32:38 -07:00
James M Snell
a6879bfab6
http2: custom promisify for http2.connect
...
... and some other cleanups
PR-URL: https://github.com/nodejs/node/pull/15207
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2017-09-20 09:32:37 -07:00
Anatoli Papirovski
2ea2725ce0
http2: emit close event if request aborted
...
Fix Http2ServerRequest and Http2ServerResponse to emit close event
if the request is aborted before response.end can be called.
Fixes: https://github.com/nodejs/node/issues/15385
PR-URL: https://github.com/nodejs/node/pull/15415
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2017-09-20 07:57:45 -07:00
Ruben Bridgewater
8ce0e9a619
lib: refactor console startup
...
PR-URL: https://github.com/nodejs/node/pull/15111
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
2017-09-20 07:53:57 -07:00
Anatoli Papirovski
b9a9290e8d
http2: expand list of known headers
...
Add access-control-*, dnt, forwarded, trailer, tk,
upgrade-insecure-requests, warning, x-content-type-options and
x-frame-options to known list of headers for HTTP2. Expand tests
to account for these headers.
Fixes: https://github.com/nodejs/node/issues/15337
Refs: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers
Refs: https://www.w3.org/TR/cors/#syntax
Refs: https://www.w3.org/2011/tracking-protection/drafts/tracking-dnt.html#dnt-header-field
Refs: https://tools.ietf.org/html/rfc7239#section-4
Refs: https://tools.ietf.org/html/rfc7230#section-4.4
Refs: https://www.w3.org/2011/tracking-protection/drafts/tracking-dnt.html#response-header-field
Refs: https://www.w3.org/TR/upgrade-insecure-requests/#preference
Refs: https://tools.ietf.org/html/rfc7234#section-5.5
Refs: https://fetch.spec.whatwg.org/#x-content-type-options-header
Refs: https://tools.ietf.org/html/rfc7034
PR-URL: https://github.com/nodejs/node/pull/15434
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
2017-09-20 07:52:39 -07:00
Myles Borins
da3265ad82
errors: backport ERR_INVALID_PROTOCOL to v8.x
...
This error code originally landed in a semver-major commit and is used
by the ESM implementation. This backport includes the error message
and the documentation for the error.
I did attempt to write a test for this, but it did not seem possible
to catch an exception during import, I was also unable to execute
`node --experimental-modules` properly inside of a child_process.
I'll dig more into getting a test together, but we should backport
this fix in the mean time.
Refs: https://github.com/nodejs/node/pull/14423
Fixes: https://github.com/nodejs/node/issues/15374
PR-URL: https://github.com/nodejs/node/pull/15388
Reviewed-By: Bradley Farias <bradley.meck@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2017-09-14 13:43:58 +02:00
Anatoli Papirovski
0343eceda4
http2: fix refs to status 205, add tests
...
Fix references within http2 core to HTTP_STATUS_CONTENT_RESET to point
to the correct HTTP_STATUS_RESET_CONTENT. Add tests for status 204,
205 & 304 in respond, respondWithFD & respondWithFile. Add general
error tests for respondWithFD & respondWithFile.
PR-URL: https://github.com/nodejs/node/pull/15153
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Claudio Rodriguez <cjrodr@yahoo.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
2017-09-12 03:19:15 +02:00
Anatoli Papirovski
d8ff550528
http2: store headersSent after stream destroyed
...
Store headersSent directly on response state after finish event
is triggered, so that users can always access it.
PR-URL: https://github.com/nodejs/node/pull/15232
Fixes: https://github.com/nodejs/node/issues/15226
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
2017-09-12 03:19:09 +02:00
Bradley Farias
865a3c3daf
module: Allow runMain to be ESM
...
This follows the EPS an allows the node CLI to have ESM as an entry point.
`node ./example.mjs`. A newer V8 is needed for `import()` so that is not
included. `import.meta` is still in specification stage so that also is not
included.
PR-URL: https://github.com/nodejs/node/pull/14369
Author: Bradley Farias <bradley.meck@gmail.com >
Author: Guy Bedford <guybedford@gmail.com >
Author: Jan Krems <jan.krems@groupon.com >
Author: Timothy Gu <timothygu99@gmail.com >
Author: Michaël Zasso <targos@protonmail.com >
Author: Anna Henningsen <anna@addaleax.net >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com >
2017-09-12 03:18:35 +02:00