You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2012/12/24 15:00:21 UTC
svn commit: r1425650 - in /tomcat/trunk/java/org/apache/tomcat/websocket:
LocalStrings.properties WsFrame.java
Author: markt
Date: Mon Dec 24 14:00:21 2012
New Revision: 1425650
URL: http://svn.apache.org/viewvc?rev=1425650&view=rev
Log:
More Autobahn inspired fixes. Setting reserved bits when not expected should trigger an 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=1425650&r1=1425649&r2=1425650&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:00:21 2012
@@ -22,4 +22,5 @@ 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.notMasked=The client frame was not masked but all client frames must be masked
\ No newline at end of file
+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=1425650&r1=1425649&r2=1425650&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:00:21 2012
@@ -123,6 +123,12 @@ public class WsFrame {
int b = inputBuffer[frameStart];
fin = (b & 0x80) > 0;
rsv = (b & 0x70) >>> 4;
+ if (rsv != 0) {
+ // TODO Extensions may use rsv bits
+ throw new WsIOException(new CloseReason(
+ CloseCodes.PROTOCOL_ERROR,
+ sm.getString("wsFrame.wrongRsv", Integer.valueOf(rsv))));
+ }
opCode = (byte) (b & 0x0F);
if (!isControl()) {
if (continuationExpected) {
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org