Permalink
Browse files

Fixing a bug and small cleanup.

  • Loading branch information...
1 parent 1f87fc2 commit fd6c944dd7901e51a50452191ee204c1715d2329 @gimite gimite committed Sep 26, 2010
Showing with 3 additions and 5 deletions.
  1. BIN WebSocketMain.swf
  2. BIN WebSocketMainInsecure.zip
  3. +3 −5 flash-src/WebSocket.as
View
Binary file not shown.
View
Binary file not shown.
View
@@ -279,15 +279,13 @@ public class WebSocket extends EventDispatcher {
}
buffer.position = 1;
var data:String = "";
- for(var i:int = 1, zeroByte:String = String.fromCharCode(0x00); i <= pos; i++) {
+ for(var i:int = 1; i < pos; i++) {
if (buffer[i] == 0x00) {
- data += buffer.readUTFBytes(pos - buffer.position) + zeroByte;
+ data += buffer.readUTFBytes(i - buffer.position) + "\x00";
buffer.position = i + 1;
-
- } else if (buffer[i] == 0xff) {
- data += buffer.readUTFBytes(buffer.bytesAvailable - 1);
}
}
+ data += buffer.readUTFBytes(pos - buffer.position);
main.log("received: " + data);
dataQueue.push(encodeURIComponent(data));
dispatchEvent(new Event("message"));

0 comments on commit fd6c944

Please sign in to comment.