SKPHP1989 / phpws

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

Masking should and only should take place from client to server #26

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Try any websocket in the latest Chrome and you'll get "A server must not 
mask any frames that it sends to the client. " in the developers tool console.

What is the expected output? What do you see instead?
The expected output is for this to work :)

Please provide any additional information below.
The problem has been documented here 
http://stackoverflow.com/questions/10337255/html5-websocket-script-working-in-ub
untu-not-working-in-win7-or-winxp and it should be trivial to fix (disable 
masking from server->client messages)

Original issue reported on code.google.com by andres.riancho@gmail.com on 29 May 2012 at 2:28

GoogleCodeExporter commented 8 years ago
Please note: my code worked perfectly in Chrome 18 and works perfectly in 
Firefox.

Original comment by andres.riancho@gmail.com on 29 May 2012 at 2:29

GoogleCodeExporter commented 8 years ago
PHPWS only masks CLOSE frames by default. This is indeed correct, must have 
read the specs wrong at the time.

However all other frame types are unmasked by default (my own UriHandlers work 
fine) . BUT the ECHO example is broken since it echoes the complete message 
(including the masked frame(s)). I suspect you do something similar. The 
temporary fix is to send the message body instead of the message using 
[[IWebSocketConnection::sendString()]].

The specs are quite clear, so it should not be possible to send masked frames 
from client to server at all. So I will fix this in any case, but above 
workaround may be enough for you until I do :)

Original comment by ch...@devristo.com on 29 May 2012 at 4:08

GoogleCodeExporter commented 8 years ago

Original comment by ch...@devristo.com on 30 May 2012 at 7:14

GoogleCodeExporter commented 8 years ago
I'm getting this message in the console:

A server must not mask any frames that it sends to the client. 

Can someone tell me what to modify to make this work?

Original comment by palermom...@gmail.com on 10 Oct 2012 at 6:54

GoogleCodeExporter commented 8 years ago
So i was getting this error too. After a bit of digging around (i am new to web 
sockets), commented the entire content of encode function in WebSocketFrame 
class in websocket.framing.php file and added a return statement in the end of 
the comment "return $this -> payloadData;" (without quotes) and it seems to 
work. i basically returned an unmasked value if i understood correctly. hope 
this helps.

Original comment by achsh...@gmail.com on 23 Nov 2012 at 7:56

GoogleCodeExporter commented 8 years ago
Fixed the demo client, still it is possible to send masked frames if you want 
to.

Original comment by ch...@devristo.com on 15 Dec 2012 at 11:04

GoogleCodeExporter commented 8 years ago
Now its not possible anymore to sent masked frames from the server, and it is 
impossible to send unmasked frames to the server.

Original comment by ch...@devristo.com on 15 Dec 2012 at 11:33