manlodhi1985 / phpwebsocket

Automatically exported from code.google.com/p/phpwebsocket
0 stars 0 forks source link

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

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
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 commented 8 years ago
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