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

some fixes for the hixie protocol #112

Merged
merged 2 commits into from
Sep 2, 2013
Merged

Conversation

flaviogrossi
Copy link

hi,
i think i have spotted some other problems with the old hixie protocol:

  1. it seems the server never sends an '\xff\x00' frame to the client to close the connection
  2. the code for receiving data from client seems to expect that the rawDataReceived() is always called with the entire frame from the client, ignoring buffering. I think it should properly accumulate data before processing the frames
  3. according to the standard, it should be possible to send the upgrade header and the challenge token in two separate steps, and the server should send the headers right away and later the challenge response (when received)

number one can be reproduced by using the client here [1] while enabling debug in the client (enableTrace(True) as the first line in the main code)

number two can be exposed by simply using the client above and sending a big string. E.g. ws.send(100_1024_'a')

number three is explained here [2]

the proposed change should fix these issues. Please review and tell me if you find some problems.

also, i think in hybi protocol, when processing a message, if no mask is used, the function _extractMessageFromFrame() returns None, and an exception will be raised because None will be appended to an existing string.

thanks,
flavio

[1] https://gist.github.com/flaviogrossi/6345654
[2] http://sockjs.github.io/sockjs-protocol/sockjs-protocol-0.3.3.html#section-63

- correctly handle rawDataReceived buffering
- send the closing frame to the client before losing the connection
- send websocket upgrade header before receiving the challenge to properly
  support haproxy
fiorix added a commit that referenced this pull request Sep 2, 2013
some fixes for the hixie protocol
@fiorix fiorix merged commit 002063e into fiorix:master Sep 2, 2013
@fiorix
Copy link
Owner

fiorix commented Sep 2, 2013

dat contribution. amazing, thank you!

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

Successfully merging this pull request may close these issues.

2 participants