Decode broken when multiple calls same time
- Dominant language
- PHP
- Stars
- 0
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
```
What steps will reproduce the problem?
Send two frames in a very short time
socket.send('message1')
socket.send('message2')
As result, the decoding function does not understand when first frame end and
second one start, which causes it handle two frame as single. This lead broken
output.
Decode function is:
private function decode ($msg) {
$len = $data = $decoded = $index = null;
$len = $msg[1] & 127;
if ($len === 126) {
$this->masks = substr ($msg, 4, 4);
$data = substr ($msg, 8);
$this->initFrame = substr ($msg, 0, 4);
}
else if ($len === 127) {
$this->masks = substr ($msg, 10, 4);
$data = substr ($msg, 14);
$this->initFrame = substr ($msg, 0, 10);
}
else {
$this->masks = substr ($msg, 2, 4);
$data = substr ($msg, 6);
$this->initFrame = substr ($msg, 0, 2);
}
for ($index = 0; $index < strlen ($data); $index++) {
$decoded .= $data[$index] ^ $this->masks[$index % 4];
}
return $decoded;
}
----------------
Should there be some regonizion when frame end and then attach rest of the
message to second frame?
```
Original issue reported on code.google.com by `ottovill...@gmail.com` on 15 Nov 2012 at 9:35
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.