Author: markt Date: Mon Feb 20 23:43:30 2012 New Revision: 1291524 URL: http://svn.apache.org/viewvc?rev=1291524&view=rev Log: Modify rsv handling and complain if it is non-zero (will need to handle non-zero values for extensions).
Modified: tomcat/trunk/java/org/apache/catalina/websocket/StreamInbound.java tomcat/trunk/java/org/apache/catalina/websocket/WsFrameHeader.java Modified: tomcat/trunk/java/org/apache/catalina/websocket/StreamInbound.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/websocket/StreamInbound.java?rev=1291524&r1=1291523&r2=1291524&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/catalina/websocket/StreamInbound.java (original) +++ tomcat/trunk/java/org/apache/catalina/websocket/StreamInbound.java Mon Feb 20 23:43:30 2012 @@ -54,6 +54,13 @@ public abstract class StreamInbound impl WsInputStream wsIs = new WsInputStream(processor); WsFrameHeader header = wsIs.getFrameHeader(); + + // TODO User defined extensions may define values for rsv + if (header.getRsv() > 0) { + getOutbound().close(1002, null); + return SocketState.CLOSED; + } + byte opCode = header.getOpCode(); validateOpCode(opCode); Modified: tomcat/trunk/java/org/apache/catalina/websocket/WsFrameHeader.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/websocket/WsFrameHeader.java?rev=1291524&r1=1291523&r2=1291524&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/catalina/websocket/WsFrameHeader.java (original) +++ tomcat/trunk/java/org/apache/catalina/websocket/WsFrameHeader.java Mon Feb 20 23:43:30 2012 @@ -23,17 +23,13 @@ package org.apache.catalina.websocket; public class WsFrameHeader { private final boolean fin; - private final boolean rsv1; - private final boolean rsv2; - private final boolean rsv3; + private final int rsv; private final byte opCode; public WsFrameHeader(int b) { fin = (b & 0x80) > 0; - rsv1 = (b & 0x40) > 0; - rsv2 = (b & 0x20) > 0; - rsv3 = (b & 0x10) > 0; + rsv = (b & 0x70) >>> 4; opCode = (byte) (b & 0x0F); } @@ -42,21 +38,11 @@ public class WsFrameHeader { return fin; } - public boolean getRsv1() { - return rsv1; - } - - public boolean getRsv2() { - return rsv2; - } - - public boolean getRsv3() { - return rsv3; + public int getRsv() { + return rsv; } public byte getOpCode() { return opCode; } - - } --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org