-
-
Notifications
You must be signed in to change notification settings - Fork 31.5k
inspector: handle socket close before close frame #12937
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Conversation
At least one popular frontend is not properly following WS protocol specification, this change protects from such clients. |
src/inspector_socket.cc
Outdated
@@ -335,6 +335,10 @@ static void websockets_data_cb(uv_stream_t* stream, ssize_t nread, | |||
if (!inspector->shutting_down && inspector->ws_state->read_cb) { | |||
inspector->ws_state->read_cb(stream, nread, nullptr); | |||
} | |||
if (inspector->ws_state->close_sent | |||
&& !inspector->ws_state->received_close) { |
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.
Can you move the &&
to the previous line.
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.
Done.
@cjihrig I have addressed the comment. Please take another look. |
Landed as 7c3a23b |
This change handles clients that respond to close request with a TCP close instead of close response. PR-URL: nodejs#12937 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
This change handles clients that respond to close request with a TCP
close instead of close response.
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passesAffected core subsystem(s)
inpsector: updated the protocol handler and added a test case.