Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use binary statemachine to parse websocket frames #35

Closed
theturtle32 opened this issue Aug 7, 2010 · 1 comment
Closed

Use binary statemachine to parse websocket frames #35

theturtle32 opened this issue Aug 7, 2010 · 1 comment

Comments

@theturtle32
Copy link

Right now, the websocket adapter in the server sets the connection encoding: with this.connection.setEncoding('utf8');

It thus receives the incoming data as utf8 encoded and splits on \ufffd -- the unicode U+FFFD REPLACEMENT CHARACTER. This is inappropriate as it violates the spec, which indicates that the protocol itself is binary and the individual frames should be interpreted as utf8.

Also, the current internet draft of the WebSocket protocol (after Draft 76) uses a completely different framing method which will mandate parsing in binary. It will no longer be possible to read the bytes as UTF-8. See the latest protocol at http://www.whatwg.org/specs/web-socket-protocol/

It may be acceptable for now to keep the current implementation for now and then switch out the frame parsing entirely to handle implementations of the next official draft. However, be aware that a legitimate message could theoretically legitimately contain \ufffd in a position that doesn't indicate a frame boundary, which would break today's parser.

@rauchg
Copy link
Contributor

rauchg commented Sep 5, 2010

Will reopen for the next official draft.

darrachequesne pushed a commit that referenced this issue Jul 4, 2024
Try different transports upon connect timeout (fixes #35)
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants