Skip to content
Permalink
Browse files

Protocol: Read the whole frame when length is zero.

When the length of the message is zero, the `readFrame` method returns
earlier. However, if a masking key is present in the frame, it is not
read and then still present in the buffer. So the next `readFrame` calls
will be invalidated. To avoid that, the masking key is read, so the
whole frame, each time the `readFrame` method is called.
  • Loading branch information...
Hywan committed Jun 24, 2016
1 parent 9b0418d commit d54553799867c2fe8ac2f21ff92e53430ccdd6ce
Showing with 5 additions and 0 deletions.
  1. +5 −0 Protocol/Rfc6455.php
@@ -153,6 +153,11 @@ public function readFrame()
if (0 === $length) {
$out['message'] = '';
// Consume the whole frame.
if (0x1 === $out['mask']) {
$connection->read(4);
}
return $out;
} elseif (0x7e === $length) {
$handle = unpack('nl', $connection->read(2));

0 comments on commit d545537

Please sign in to comment.
You can’t perform that action at this time.