Skip to content

Commit

Permalink
Fixing a bug and small cleanup.
Browse files Browse the repository at this point in the history
  • Loading branch information
gimite committed Sep 26, 2010
1 parent 1f87fc2 commit fd6c944
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 5 deletions.
Binary file modified WebSocketMain.swf
Binary file not shown.
Binary file modified WebSocketMainInsecure.zip
Binary file not shown.
8 changes: 3 additions & 5 deletions flash-src/WebSocket.as
Original file line number Diff line number Diff line change
Expand Up @@ -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"));
Expand Down

0 comments on commit fd6c944

Please sign in to comment.