This repository has been archived by the owner on Sep 20, 2021. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Protocol: Relax UTF-8 checking when sending.
All messages sent with `Protocol\Rfc6455::send` must be UTF-8 encoded. This is a hard constraint. All messages received by the server must be UTF-8 encoded, so we ease the work of the server and avoid sending invalid messages by adding this constraint. This constraint was checked when the opcode was either `OPCODE_TEXT_FRAME` or `OPCODE_CONTINUATION_FRAME`. This is wrong because in some cases a valid UTF-8 message can be send byte after byte as fragments. Each fragment is not necessarily a valid UTF-8 string. So now, this constraint is checked only when the opcode is `OPCODE_TEXT_FRAME` and when the message is not fragmented (so `end` is set to `true`). And so, this is possible to send a valid UTF-8 message as many invalid UTF-8 fragments.
- Loading branch information