Commit 7dfa20b8 authored by Joel Martin's avatar Joel Martin

Remove invalid pos check from web-socket-js.

parent 094b489b
...@@ -187,6 +187,7 @@ public class WebSocket extends EventDispatcher { ...@@ -187,6 +187,7 @@ public class WebSocket extends EventDispatcher {
main.log("request header:\n" + req); main.log("request header:\n" + req);
socket.writeUTFBytes(req); socket.writeUTFBytes(req);
main.log("sent key3: " + key3); main.log("sent key3: " + key3);
main.log("expected digest: " + expectedDigest);
writeBytes(key3); writeBytes(key3);
socket.flush(); socket.flush();
} }
...@@ -250,20 +251,18 @@ public class WebSocket extends EventDispatcher { ...@@ -250,20 +251,18 @@ public class WebSocket extends EventDispatcher {
pos = -1; pos = -1;
} }
} else if (headerState == 4) { } else if (headerState == 4) {
if (pos == 15) { var replyDigest:String = readBytes(buffer, 16);
var replyDigest:String = readBytes(buffer, 16); main.log("reply digest: " + replyDigest);
main.log("reply digest: " + replyDigest); if (replyDigest != expectedDigest) {
if (replyDigest != expectedDigest) { onError("digest doesn't match: " + replyDigest + " != " + expectedDigest);
onError("digest doesn't match: " + replyDigest + " != " + expectedDigest); return;
return;
}
headerState = 5;
makeBufferCompact();
pos = -1;
readyState = OPEN;
notifyStateChange();
dispatchEvent(new Event("open"));
} }
headerState = 5;
makeBufferCompact();
pos = -1;
readyState = OPEN;
notifyStateChange();
dispatchEvent(new Event("open"));
} else { } else {
if (buffer[pos] == 0xff) { if (buffer[pos] == 0xff) {
//if (buffer.bytesAvailable > 1) { //if (buffer.bytesAvailable > 1) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment