Skip to content

Bug: can't handle multiple frames in same chunk (lost payload) #13

@Pithikos

Description

@Pithikos

Due to the way the recv works in the server, it can't handle situations where multiple information come via the same websocket message at once.

Example

myserver._decode_data_frame(b'\x89\x80z\x95`\xc7\x81\xfe\x00\x95j\xb1\n\x00\x11\x93ov\x0f\xdf~"P')
# Recognizes as a PING

In the above case a ping comes and directly after a valid payload is followed but is totally discarded by the server.

The culprit is in this code

    def _recv(self, client, user=False):
        """Receive a message from the client. Will block this thread until a message is received.

            :param client: The client to receive a message from.
        """
        try:
            address = client.getpeername()
            data = client.recv(2048)
            ..

The right approach would be to read the message byte-by-byte instead of an arbitrary chunk.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions