austgl / phpws

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

Hixie messages from Safari client get padded with spaces #11

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
When using Safari as a client for the demo, server reconstructs message data as 
an initial string prepended by a blank and with appended blank. This can be 
seen in debug logs, and what responses are shown in the client as the echo.

I can't thoroughly investigate RFCs right now, so I did not manage to fix this 
(except for an idea of just trimming the string which seems incorrect 
approach), whereas Safari is not so outdated that it could not have a decent 
support, imho.

Original issue reported on code.google.com by mo...@tushino.ru on 21 Dec 2011 at 10:40

GoogleCodeExporter commented 9 years ago
BTW, I see something like a bug. In WebSocketFrame76::create there is the 
payloadData = $data. At the same time in WebSocketFrame76::decode, it is 
payloadData = substr($str, 1, strlen($str) - 2). The problem is that decode is 
not used, while create is not equivalent.

Original comment by mo...@tushino.ru on 21 Dec 2011 at 10:46

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Weird didnt see your comment. Decode should be used when deserializing the 
received packet. If thats not the case its a bug :)

Create is only to create a new object with specific data.

Original comment by ch...@devristo.com on 21 Dec 2011 at 11:01

GoogleCodeExporter commented 9 years ago
Yes, in protocol.php line 273 should be something like this:

$m = WebSocketMessage76::create(WebSocketFrame76::decode($data)->getData());

Works for me.

Original comment by mo...@tushino.ru on 21 Dec 2011 at 11:14

GoogleCodeExporter commented 9 years ago
You should use fromFrame instead of create and the getData(). Will fix this now 
:)

Original comment by ch...@devristo.com on 22 Dec 2011 at 8:16

GoogleCodeExporter commented 9 years ago

Original comment by ch...@devristo.com on 5 Jan 2012 at 9:54