Author: markt Date: Mon Dec 24 14:09:05 2012 New Revision: 1425651 URL: http://svn.apache.org/viewvc?rev=1425651&view=rev Log: Unsupported opCode should trigger a protocol error.
Modified: tomcat/trunk/java/org/apache/tomcat/websocket/LocalStrings.properties tomcat/trunk/java/org/apache/tomcat/websocket/WsFrame.java Modified: tomcat/trunk/java/org/apache/tomcat/websocket/LocalStrings.properties URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/websocket/LocalStrings.properties?rev=1425651&r1=1425650&r2=1425651&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/tomcat/websocket/LocalStrings.properties (original) +++ tomcat/trunk/java/org/apache/tomcat/websocket/LocalStrings.properties Mon Dec 24 14:09:05 2012 @@ -22,5 +22,6 @@ uriTemplate.noMatch=The input template [ wsFrame.byteToLongFail=Too many bytes ([{0}]) were provided to be converted into a long wsFrame.controlPayloadTooBig=A control frame was sent with a payload of length [{0}] which is larger than the maximum length permitted of 125 bytes wsFrame.controlNoFin=A control frame was sent that did not have the fin bit set. Control frames are not permitted to use continuation frames. +wsFrame.invalidOpCode= A WebSocket frame was sent with an unrecognised opCode of [{0}] wsFrame.notMasked=The client frame was not masked but all client frames must be masked wsFrame.wrongRsv=The client frame set the reserved bits to [{0}] which was not supported by this endpoint \ No newline at end of file Modified: tomcat/trunk/java/org/apache/tomcat/websocket/WsFrame.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/websocket/WsFrame.java?rev=1425651&r1=1425650&r2=1425651&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/tomcat/websocket/WsFrame.java (original) +++ tomcat/trunk/java/org/apache/tomcat/websocket/WsFrame.java Mon Dec 24 14:09:05 2012 @@ -142,8 +142,10 @@ public class WsFrame { } else if (opCode == Constants.OPCODE_TEXT) { textMessage = true; } else { - // TODO i18n - throw new UnsupportedOperationException(); + throw new WsIOException(new CloseReason( + CloseCodes.PROTOCOL_ERROR, + sm.getString("wsFrame.invalidOpCode", + Integer.valueOf(opCode)))); } } continuationExpected = !fin; @@ -231,8 +233,10 @@ public class WsFrame { mhPong.onMessage(new WsPongMessage(messageBuffer)); } } else { - // TODO i18n - throw new UnsupportedOperationException(); + throw new WsIOException(new CloseReason( + CloseCodes.PROTOCOL_ERROR, + sm.getString("wsFrame.invalidOpCode", + Integer.valueOf(opCode)))); } newMessage(); return true; --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org