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

Patch for /trunk/ phpwebsocket/server.php #47

Open
GoogleCodeExporter opened this issue Feb 21, 2016 · 1 comment
Open

Patch for /trunk/ phpwebsocket/server.php #47

GoogleCodeExporter opened this issue Feb 21, 2016 · 1 comment

Comments

@GoogleCodeExporter
Copy link

updated the websocket program to use the current websocket specification used 
by firefox and chrome. should be compliant up to version 
17(http://tools.ietf.org/html/draft-ietf-hybi-thewebsocketprotocol-17) 

likely still needs some work

Original issue reported on code.google.com by tuser...@gmail.com on 6 Feb 2012 at 6:43

Attachments:

@GoogleCodeExporter
Copy link
Author

I believe you're calculating the payload lengths incorrectly with the 16 bit 
and 64 bit values.

For example:

$length=ord($msg[$index])+ord($msg[$index+1])

You're summing the two byte values together there, instead of considering them 
as one 16 bit number. I'm pretty sure it should be something like:

$length = (ord($msg[$index]) << 8) | ord($msg[$index + 1]); // shifts 8 bits 
left and adds the second byte

In addition at the line:
return $payload.processMsg(substr($msg,$index));

I think you meant calling the function recursively, thus the correct function 
name would be unwrap(), or then I missed the other function :).


Original comment by terho.si...@gmail.com on 6 Apr 2012 at 1:24

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant