Skip to content

Commit 8750356

Browse files
fix: check the type of the initial packet
Before this fix, the client could mark the polling transport as open even though the handshake packet was not received properly (for example, after a parsing error). This could lead to writes (POST requests) without "sid" query param, which failed with: ``` {"code":2,"message":"Bad handshake method"} ``` Related: - #636 - socketio/socket.io-client#1390 Cherry-picked from master: 1c8cba8
1 parent 0b254ce commit 8750356

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/transports/polling.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ Polling.prototype.onData = function (data) {
130130
debug('polling got data %s', data);
131131
var callback = function (packet, index, total) {
132132
// if its the first message we consider the transport open
133-
if ('opening' === self.readyState) {
133+
if ('opening' === self.readyState && packet.type === 'open') {
134134
self.onOpen();
135135
}
136136

0 commit comments

Comments
 (0)