Bug 362853 - Promoting all Websocket STRICT blocks to standard behavior

This commit is contained in:
Joakim Erdfelt 2011-11-04 09:40:32 -07:00
parent 3d0300e60d
commit 373a2946be
1 changed files with 17 additions and 20 deletions

View File

@ -43,7 +43,6 @@ import org.eclipse.jetty.websocket.WebSocket.OnTextMessage;
public class WebSocketConnectionD13 extends AbstractConnection implements WebSocketConnection
{
private static final Logger LOG = Log.getLogger(WebSocketConnectionD13.class);
private static final boolean STRICT=Boolean.getBoolean("org.eclipse.jetty.websocket.STRICT");
private static final boolean BRUTAL=Boolean.getBoolean("org.eclipse.jetty.websocket.BRUTAL");
final static byte OP_CONTINUATION = 0x00;
@ -645,8 +644,6 @@ public class WebSocketConnectionD13 extends AbstractConnection implements WebSoc
{
byte[] array=buffer.array();
if (STRICT)
{
if (isControlFrame(opcode) && buffer.length()>MAX_CONTROL_FRAME_PAYLOAD)
{
errorClose(WebSocketConnectionD13.CLOSE_PROTOCOL,"Control frame too large: " + buffer.length() + " > " + MAX_CONTROL_FRAME_PAYLOAD);
@ -662,6 +659,7 @@ public class WebSocketConnectionD13 extends AbstractConnection implements WebSoc
// Ignore all frames after error close
if (_closeCode!=0 && _closeCode!=CLOSE_NORMAL && opcode!=OP_CLOSE)
{
return;
}
@ -786,7 +784,7 @@ public class WebSocketConnectionD13 extends AbstractConnection implements WebSoc
case WebSocketConnectionD13.OP_TEXT:
{
if (STRICT && _opcode!=-1)
if (_opcode!=-1)
{
errorClose(WebSocketConnectionD13.CLOSE_PROTOCOL,"Expected Continuation"+Integer.toHexString(opcode));
return;
@ -827,7 +825,7 @@ public class WebSocketConnectionD13 extends AbstractConnection implements WebSoc
case WebSocketConnectionD13.OP_BINARY:
{
if (STRICT && _opcode!=-1)
if (_opcode!=-1)
{
errorClose(WebSocketConnectionD13.CLOSE_PROTOCOL,"Expected Continuation"+Integer.toHexString(opcode));
return;
@ -857,7 +855,6 @@ public class WebSocketConnectionD13 extends AbstractConnection implements WebSoc
}
default:
if (STRICT)
errorClose(WebSocketConnectionD13.CLOSE_PROTOCOL,"Bad opcode 0x"+Integer.toHexString(opcode));
return;
}