http2: add test-http2-date-header.js
This is porting the http1 test https://github.com/nodejs/http2/blob/98e54b0bd4854bdb3e2949d1b6b20d6777fb7cde/test/parallel/test-http-date-header.js to http2.
I found several issues (see comments in test):
[ ] req.url is undefined, due to missing accessor for url
[ ] req.headers is undefined
[ ] req.getHeader('date') crashes with:
For the header issues, it seems stream[kHeaders] is returning undefined.
Stacktrace:
internal/http2/compat.js:180
return headers.get(name);
^
TypeError: Cannot read property 'get' of undefined
at Http2ServerRequest.getHeader (internal/http2/compat.js:180:19)
at Http2Server.http2.createServer (/Users/robert/projects/http2/test/parallel/test-http2-date-header.js:37:27)
at emitTwo (events.js:125:13)
at Http2Server.emit (events.js:213:7)
at Http2Server.onServerStream (internal/http2/compat.js:497:10)
at emitThree (events.js:135:13)
at Http2Server.emit (events.js:216:7)
at Http2Session.sessionOnStream (internal/http2/core.js:1042:10)
at emitThree (events.js:135:13)
at Http2Session.emit (events.js:216:7)
It seems stream[kHeaders] is returning undefined
Code for req.headers and req.getHeader, note the use of stream[kHeaders]:
get headers() {
var stream = this[kStream];
return stream ? stream[kHeaders] : undefined;
}
getHeader(name) {
var stream = this[kStream];
if (!stream)
return;
var headers = stream[kHeaders];
name = String(name).trim().toLowerCase();
return headers.get(name);
}
So far I haven't found out why exactly stream[kHeaders] does not return the right value and need help with that.
UPDATE: all issues fixed.
Checklist
- [x]
make -j4 test(UNIX), orvcbuild test(Windows) passes - [x] commit message follows commit guidelines
Affected core subsystem(s)
http2
thanks for your feedback.
i found another issue before i am ready to rebase and i am ready for the final review: https://github.com/nodejs/http2/issues/99
@robertkowalski any update on this one?
@mcollina i am blocked on https://github.com/nodejs/http2/issues/99, except i add a fake listener for data which is an ugly workaround imo
thanks for your help and the friendly nudge @mcollina
all is ready now :)
This will need to be rebased :-)
fixed, but it seems the tests of other http2 functionality are red right now?
=== release test-http2-client-rststream-before-connect ===
Path: parallel/test-http2-client-rststream-before-connect
Mismatched <anonymous> function calls. Expected exactly 1, actual 0.
at Object.exports.mustCall (/Users/robert/projects/http2/test/common/index.js:483:10)
at Object.<anonymous> (/Users/robert/projects/http2/test/parallel/test-http2-client-rststream-before-connect.js:10:28)
at Module._compile (module.js:569:30)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:503:32)
at tryModuleLoad (module.js:466:12)
at Function.Module._load (module.js:458:3)
at Function.Module.runMain (module.js:605:10)
at startup (bootstrap_node.js:158:16)
(node:8689) ExperimentalWarning: The http2 module is an experimental API.
Command: out/Release/node /Users/robert/projects/http2/test/parallel/test-http2-client-rststream-before-connect.js
=== release test-http2-client-stream-destroy-before-connect ===
Path: parallel/test-http2-client-stream-destroy-before-connect
Mismatched <anonymous> function calls. Expected exactly 1, actual 0.
at Object.exports.mustCall (/Users/robert/projects/http2/test/common/index.js:483:10)
at Object.<anonymous> (/Users/robert/projects/http2/test/parallel/test-http2-client-stream-destroy-before-connect.js:11:28)
at Module._compile (module.js:569:30)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:503:32)
at tryModuleLoad (module.js:466:12)
at Function.Module._load (module.js:458:3)
at Function.Module.runMain (module.js:605:10)
at startup (bootstrap_node.js:158:16)
(node:8694) ExperimentalWarning: The http2 module is an experimental API.
Command: out/Release/node /Users/robert/projects/http2/test/parallel/test-http2-client-stream-destroy-before-connect.js
=== release test-http2-create-client-connect ===
Path: parallel/test-http2-create-client-connect
Mismatched noop function calls. Expected exactly 1, actual 0.
at Object.exports.mustCall (/Users/robert/projects/http2/test/common/index.js:483:10)
at Http2Server.<anonymous> (/Users/robert/projects/http2/test/parallel/test-http2-create-client-connect.js:46:29)
at Http2Server.<anonymous> (/Users/robert/projects/http2/test/common/index.js:517:15)
at emitNone (events.js:105:13)
at Http2Server.emit (events.js:207:7)
at emitListeningNT (net.js:1332:10)
at _combinedTickCallback (internal/process/next_tick.js:99:11)
at process._tickCallback (internal/process/next_tick.js:161:9)
at Function.Module.runMain (module.js:607:11)
(node:8707) ExperimentalWarning: The http2 module is an experimental API.
Command: out/Release/node /Users/robert/projects/http2/test/parallel/test-http2-create-client-connect.js
[03:14|% 100|+ 1621|- 3]: Done
make: *** [test] Error 1
Yeah, will need my current PR to land.
It should work now after a rebase.
sorry, still doesn't work:
/usr/bin/python tools/test.py --mode=release -J \
doctool inspector known_issues message pseudo-tty parallel sequential \
async-hooks addons addons-napi
=== release test-http2-client-rststream-before-connect ===
Path: parallel/test-http2-client-rststream-before-connect
Mismatched <anonymous> function calls. Expected exactly 1, actual 0.
at Object.exports.mustCall (/Users/robert/projects/http2/test/common/index.js:483:10)
at Object.<anonymous> (/Users/robert/projects/http2/test/parallel/test-http2-client-rststream-before-connect.js:10:28)
at Module._compile (module.js:569:30)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:503:32)
at tryModuleLoad (module.js:466:12)
at Function.Module._load (module.js:458:3)
at Function.Module.runMain (module.js:605:10)
at startup (bootstrap_node.js:158:16)
(node:31476) ExperimentalWarning: The http2 module is an experimental API.
Command: out/Release/node /Users/robert/projects/http2/test/parallel/test-http2-client-rststream-before-connect.js
=== release test-http2-client-stream-destroy-before-connect ===
Path: parallel/test-http2-client-stream-destroy-before-connect
Mismatched <anonymous> function calls. Expected exactly 1, actual 0.
at Object.exports.mustCall (/Users/robert/projects/http2/test/common/index.js:483:10)
at Object.<anonymous> (/Users/robert/projects/http2/test/parallel/test-http2-client-stream-destroy-before-connect.js:11:28)
at Module._compile (module.js:569:30)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:503:32)
at tryModuleLoad (module.js:466:12)
at Function.Module._load (module.js:458:3)
at Function.Module.runMain (module.js:605:10)
at startup (bootstrap_node.js:158:16)
(node:31481) ExperimentalWarning: The http2 module is an experimental API.
Command: out/Release/node /Users/robert/projects/http2/test/parallel/test-http2-client-stream-destroy-before-connect.js
=== release test-http2-create-client-connect ===
Path: parallel/test-http2-create-client-connect
Mismatched noop function calls. Expected exactly 1, actual 0.
at Object.exports.mustCall (/Users/robert/projects/http2/test/common/index.js:483:10)
at Http2Server.<anonymous> (/Users/robert/projects/http2/test/parallel/test-http2-create-client-connect.js:46:29)
at Http2Server.<anonymous> (/Users/robert/projects/http2/test/common/index.js:517:15)
at emitNone (events.js:105:13)
at Http2Server.emit (events.js:207:7)
at emitListeningNT (net.js:1332:10)
at _combinedTickCallback (internal/process/next_tick.js:99:11)
at process._tickCallback (internal/process/next_tick.js:161:9)
at Function.Module.runMain (module.js:607:11)
(node:31494) ExperimentalWarning: The http2 module is an experimental API.
Command: out/Release/node /Users/robert/projects/http2/test/parallel/test-http2-create-client-connect.js
=== release test-http2-server-startup ===
Path: parallel/test-http2-server-startup
(node:31514) ExperimentalWarning: The http2 module is an experimental API.
events.js:182
throw er; // Unhandled 'error' event
^
Error: socket hang up
at TLSSocket.onHangUp (_tls_wrap.js:1140:19)
at Object.onceWrapper (events.js:312:19)
at emitNone (events.js:110:20)
at TLSSocket.emit (events.js:207:7)
at endReadableNT (_stream_readable.js:1045:12)
at _combinedTickCallback (internal/process/next_tick.js:102:11)
at process._tickCallback (internal/process/next_tick.js:161:9)
Command: out/Release/node /Users/robert/projects/http2/test/parallel/test-http2-server-startup.js
[03:20|% 100|+ 1621|- 4]: Done
make: *** [test] Error 1
(00:40:04) [robert@tequila-new] ~/projects/http2 (test-http2-date-header) $ git log --format=short
commit 8faa0d155c8d1d522fa12478149247cd30f58de9
Author: Robert Kowalski <[email protected]>
[squash] review: add common must-call
commit 24c3779b25287ea030de00f7559688057fca4ee8
Author: Robert Kowalski <[email protected]>
http2: add test-http2-date-header.js
commit 9b6b0676221903592ba5a8145dfd10b87cc60ce6
Author: Sebastiaan Deckers <[email protected]>
http2: reject incompatible TLS ALPN handshakes
commit 897d5b1e66ff72a6bb97334c53a76d01fea25606
Author: James M Snell <[email protected]>
http2: additional cleanups, fixes and docs
Interesting... the only failure I'm getting is the socketHangUp which is fixed by my other PR. What platform are you on?
@mcollina ... can you test to see if you see the same issues @robertkowalski is getting?
I'm getting:
Path: parallel/test-http2-client-rststream-before-connect
Mismatched <anonymous> function calls. Expected exactly 1, actual 0.
at Object.exports.mustCall (/Users/matteo/Repositories/http2/test/common/index.js:483:10)
at Object.<anonymous> (/Users/matteo/Repositories/http2/test/parallel/test-http2-client-rststream-before-connect.js:10:28)
at Module._compile (module.js:569:30)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:503:32)
at tryModuleLoad (module.js:466:12)
at Function.Module._load (module.js:458:3)
at Function.Module.runMain (module.js:605:10)
at startup (bootstrap_node.js:158:16)
(node:63993) ExperimentalWarning: The http2 module is an experimental API.
Command: out/Release/node /Users/matteo/Repositories/http2/test/parallel/test-http2-client-rststream-before-connect.js
[03:06|% 100|+ 1623|- 1]: Done
make: *** [test] Error 1
EDIT: on master, and without this applied.