-
Notifications
You must be signed in to change notification settings - Fork 30.3k
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: fix closedCode NaN, increase test coverage #15154
http2: fix closedCode NaN, increase test coverage #15154
Conversation
Can you move the The actual code part looks sane. Would you mind explaining when kClosed may be called without a code? |
(kFinish, sorry) |
e2dd893
to
e6d33c3
Compare
Took out setTimeout. Will open a PR for it shortly. Re: when it can be called, pretty much anytime you do The test included in this will fail if you try it without applying the patch. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be awesome to have that explanation in the commit message!
e6d33c3
to
27c9bfe
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for doing all these! Changes lgtm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reaffirming my LGTM...
@apapirovski can you please rebase? I'll trigger a CI run then. |
[kFinish](code) can be triggered from a 'finish' event (for example when calling response.end) which does not pass code. That tries to set closedCode to undefined resulting in NaN closedCode instead of NGHTTP2_NO_ERROR. Check for code !== undefined before setting. Adds tests for closed and closedCode.
27c9bfe
to
804fdbe
Compare
@targos All good to go now. |
[kFinish](code) can be triggered from a 'finish' event (for example when calling response.end) which does not pass code. That tries to set closedCode to undefined resulting in NaN closedCode instead of NGHTTP2_NO_ERROR. Check for code !== undefined before setting. Adds tests for closed and closedCode. PR-URL: #15154 Reviewed-By: Timothy Gu <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: James M Snell <[email protected]>
Landed in 800c32d |
[kFinish](code) can be triggered from a 'finish' event (for example when calling response.end) which does not pass code. That tries to set closedCode to undefined resulting in NaN closedCode instead of NGHTTP2_NO_ERROR. Check for code !== undefined before setting. Adds tests for closed and closedCode. PR-URL: #15154 Reviewed-By: Timothy Gu <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: James M Snell <[email protected]>
[kFinish](code) can be triggered from a 'finish' event (for example when calling response.end) which does not pass code. That tries to set closedCode to undefined resulting in NaN closedCode instead of NGHTTP2_NO_ERROR. Check for code !== undefined before setting. Adds tests for closed and closedCode. PR-URL: #15154 Reviewed-By: Timothy Gu <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: James M Snell <[email protected]>
[kFinish](code) can be triggered from a 'finish' event (for example when calling response.end) which does not pass code. That tries to set closedCode to undefined resulting in NaN closedCode instead of NGHTTP2_NO_ERROR. Check for code !== undefined before setting. Adds tests for closed and closedCode. PR-URL: #15154 Reviewed-By: Timothy Gu <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: James M Snell <[email protected]>
[kFinish](code) can be triggered from a 'finish' event (for example when calling response.end) which does not pass code. That tries to set closedCode to undefined resulting in NaN closedCode instead of NGHTTP2_NO_ERROR. Check for code !== undefined before setting. Adds tests for closed and closedCode. PR-URL: nodejs#15154 Reviewed-By: Timothy Gu <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: James M Snell <[email protected]>
[kFinish](code)
can be triggered without passingcode
. Until now, the method tried to set closedCode toundefined
resulting inNaN
closedCode instead ofNGHTTP2_NO_ERROR
. Added a check forcode !== undefined
before setting.Also adds tests for
closed
(request only, response covered by another PR previously) andclosedCode
(both).Adds tests for Http2ServerRequest and Http2ServerResponseEdit: separate PR now: #15156setTimeout
.Let me know if there's anything I can change. Thanks!
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passesAffected core subsystem(s)
http2, test