-
-
Notifications
You must be signed in to change notification settings - Fork 33.9k
Closed
Labels
http2Issues or PRs related to the http2 subsystem.Issues or PRs related to the http2 subsystem.questionIssues that look for answers.Issues that look for answers.
Description
I was writing unit tests for invalid options passed to http2.session.shutdown() as part of #14985 for
node/lib/internal/http2/core.js
Lines 999 to 1024 in 2f2f1cf
| if (options.opaqueData !== undefined && | |
| !isUint8Array(options.opaqueData)) { | |
| throw new errors.TypeError('ERR_INVALID_OPT_VALUE', | |
| 'opaqueData', | |
| options.opaqueData); | |
| } | |
| if (type === NGHTTP2_SESSION_SERVER && | |
| options.graceful !== undefined && | |
| typeof options.graceful !== 'boolean') { | |
| throw new errors.TypeError('ERR_INVALID_OPT_VALUE', | |
| 'graceful', | |
| options.graceful); | |
| } | |
| if (options.errorCode !== undefined && | |
| typeof options.errorCode !== 'number') { | |
| throw new errors.TypeError('ERR_INVALID_OPT_VALUE', | |
| 'errorCode', | |
| options.errorCode); | |
| } | |
| if (options.lastStreamID !== undefined && | |
| (typeof options.lastStreamID !== 'number' || | |
| options.lastStreamID < 0)) { | |
| throw new errors.TypeError('ERR_INVALID_OPT_VALUE', | |
| 'lastStreamID', | |
| options.lastStreamID); | |
| } |
Should we check for invalid options before setting this[kState].shuttingDown to true?
node/lib/internal/http2/core.js
Line 987 in 2f2f1cf
| this[kState].shuttingDown = true; |
Currently, if there are invalid options:
this[kState].shuttingDownis set to true- an exception is thrown
- the session is not shut down.
When shutdown is called for the second time, it returns because of the following check
node/lib/internal/http2/core.js
Lines 983 to 984 in 2f2f1cf
| if (this[kState].shutdown || this[kState].shuttingDown) | |
| return; |
In this case, the only way to end the session is to destroy it.
Metadata
Metadata
Assignees
Labels
http2Issues or PRs related to the http2 subsystem.Issues or PRs related to the http2 subsystem.questionIssues that look for answers.Issues that look for answers.