-
Notifications
You must be signed in to change notification settings - Fork 30.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
http2: add edge case to GOAWAY request
PR-URL: #42190 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
- Loading branch information
1 parent
cda623c
commit ddef6bb
Showing
2 changed files
with
28 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
'use strict'; | ||
|
||
const common = require('../common'); | ||
if (!common.hasCrypto) | ||
common.skip('missing crypto'); | ||
|
||
const http2 = require('http2'); | ||
|
||
const server = http2.createServer(); | ||
|
||
server.listen(0, () => { | ||
const client = http2.connect(`http://localhost:${server.address().port}`); | ||
client.on('close', common.mustCall(() => { | ||
server.close(); | ||
})); | ||
|
||
// The client.close() is executed before the socket is able to make request | ||
const stream = client.request(); | ||
stream.on('error', common.expectsError({ code: 'ERR_HTTP2_GOAWAY_SESSION' })); | ||
|
||
setImmediate(() => client.close()); | ||
}); |