mirror of https://github.com/lukechilds/node.git
Browse Source
Refs: #14985 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>v9.x-staging
committed by
Matteo Collina
5 changed files with 129 additions and 123 deletions
@ -1,29 +0,0 @@ |
|||||
'use strict'; |
|
||||
|
|
||||
const common = require('../common'); |
|
||||
if (!common.hasCrypto) |
|
||||
common.skip('missing crypto'); |
|
||||
const h2 = require('http2'); |
|
||||
|
|
||||
const server = h2.createServer(); |
|
||||
|
|
||||
// we use the lower-level API here
|
|
||||
server.on('stream', common.mustNotCall()); |
|
||||
|
|
||||
server.listen(0); |
|
||||
|
|
||||
server.on('listening', common.mustCall(() => { |
|
||||
|
|
||||
const client = h2.connect(`http://localhost:${server.address().port}`); |
|
||||
|
|
||||
const req = client.request({ ':path': '/' }); |
|
||||
client.destroy(); |
|
||||
|
|
||||
req.on('response', common.mustNotCall()); |
|
||||
req.resume(); |
|
||||
req.on('end', common.mustCall(() => { |
|
||||
server.close(); |
|
||||
})); |
|
||||
req.end(); |
|
||||
|
|
||||
})); |
|
@ -1,29 +0,0 @@ |
|||||
'use strict'; |
|
||||
|
|
||||
const common = require('../common'); |
|
||||
if (!common.hasCrypto) |
|
||||
common.skip('missing crypto'); |
|
||||
const assert = require('assert'); |
|
||||
const h2 = require('http2'); |
|
||||
|
|
||||
const server = h2.createServer(); |
|
||||
|
|
||||
// we use the lower-level API here
|
|
||||
server.on('stream', common.mustNotCall()); |
|
||||
|
|
||||
server.listen(0); |
|
||||
|
|
||||
server.on('listening', common.mustCall(() => { |
|
||||
|
|
||||
const client = h2.connect(`http://localhost:${server.address().port}`); |
|
||||
client.destroy(); |
|
||||
|
|
||||
assert.throws(() => client.request({ ':path': '/' }), |
|
||||
common.expectsError({ |
|
||||
code: 'ERR_HTTP2_INVALID_SESSION', |
|
||||
message: /^The session has been destroyed$/ |
|
||||
})); |
|
||||
|
|
||||
server.close(); |
|
||||
|
|
||||
})); |
|
@ -1,24 +0,0 @@ |
|||||
'use strict'; |
|
||||
|
|
||||
const common = require('../common'); |
|
||||
if (!common.hasCrypto) |
|
||||
common.skip('missing crypto'); |
|
||||
const http2 = require('http2'); |
|
||||
|
|
||||
const server = http2.createServer(); |
|
||||
server.on('stream', common.mustCall((stream) => { |
|
||||
stream.on('error', common.mustCall()); |
|
||||
stream.session.shutdown(); |
|
||||
})); |
|
||||
|
|
||||
server.listen(0, common.mustCall(() => { |
|
||||
const client = http2.connect(`http://localhost:${server.address().port}`); |
|
||||
|
|
||||
client.on('goaway', common.mustCall(() => { |
|
||||
// We ought to be able to destroy the client in here without an error
|
|
||||
server.close(); |
|
||||
client.destroy(); |
|
||||
})); |
|
||||
|
|
||||
client.request(); |
|
||||
})); |
|
Loading…
Reference in new issue