-
Notifications
You must be signed in to change notification settings - Fork 30k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
http2: check if callback is valid before closing the request? #18855
Comments
cc @nodejs/http2 |
I think this is a bug, would you mind sending a PR? |
Sure, I'll post a PR in a day or two |
@trivikr why is this blocked by those? Can you open the PR in the meanwhile? |
I can make the code change and test it by running just single test as defined in https://github.com/nodejs/node/blob/master/doc/guides/contributing/pull-requests.md#step-6-test However, since coverage is failing on my machine and also at coverage.nodejs.org I would like to wait for that fix before posting a PR. |
PR posted at #19061 |
Do not close the request if callback is not a function, and throw ERR_INVALID_CALLBACK TypeError Fixes: nodejs#18855
Do not close the request if callback is not a function, and throw ERR_INVALID_CALLBACK TypeError PR-URL: nodejs#19061 Fixes: nodejs#18855 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Shingo Inoue <[email protected]> Reviewed-By: Tobias Nießen <[email protected]>
Do not close the request if callback is not a function, and throw ERR_INVALID_CALLBACK TypeError Backport-PR-URL: #19229 PR-URL: #19061 Fixes: #18855 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Shingo Inoue <[email protected]> Reviewed-By: Tobias Nießen <[email protected]>
Do not close the request if callback is not a function, and throw ERR_INVALID_CALLBACK TypeError Backport-PR-URL: nodejs#19229 PR-URL: nodejs#19061 Fixes: nodejs#18855 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Shingo Inoue <[email protected]> Reviewed-By: Tobias Nießen <[email protected]>
Do not close the request if callback is not a function, and throw ERR_INVALID_CALLBACK TypeError Backport-PR-URL: #19229 Backport-PR-URL: #20456 PR-URL: #19061 Fixes: #18855 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Shingo Inoue <[email protected]> Reviewed-By: Tobias Nießen <[email protected]>
Do not close the request if callback is not a function, and throw ERR_INVALID_CALLBACK TypeError PR-URL: nodejs#19061 Fixes: nodejs#18855 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Shingo Inoue <[email protected]> Reviewed-By: Tobias Nießen <[email protected]>
Do not close the request if callback is not a function, and throw ERR_INVALID_CALLBACK TypeError Backport-PR-URL: #19229 Backport-PR-URL: #20456 PR-URL: #19061 Fixes: #18855 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Shingo Inoue <[email protected]> Reviewed-By: Tobias Nießen <[email protected]>
Do not close the request if callback is not a function, and throw ERR_INVALID_CALLBACK TypeError Backport-PR-URL: #19229 Backport-PR-URL: #20456 PR-URL: #19061 Fixes: #18855 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Shingo Inoue <[email protected]> Reviewed-By: Tobias Nießen <[email protected]>
I came across this issue while writing unit tests for
req.close(code)
in PR #18854The function currently checks if callback is valid after performing close operation
node/lib/internal/http2/core.js
Lines 1760 to 1764 in 472cde6
In other functions (for example
ping()
,settings()
etc) the validity for callback is checked before function performs it's operation:node/lib/internal/http2/core.js
Lines 954 to 955 in 472cde6
node/lib/internal/http2/core.js
Lines 1044 to 1045 in 472cde6
Is there a reason why
req.close(code)
performs close operation even if callback is invalid?The text was updated successfully, but these errors were encountered: