Author: markt
Date: Mon Feb 29 14:11:45 2016
New Revision: 1732900

URL: http://svn.apache.org/viewvc?rev=1732900&view=rev
Log:
Correctly handle compression of partial messages when the final message 
fragment has a zero length payload.
Problem identified by Autobahn test suite.

Modified:
    tomcat/trunk/java/org/apache/tomcat/websocket/PerMessageDeflate.java
    tomcat/trunk/webapps/docs/changelog.xml

Modified: tomcat/trunk/java/org/apache/tomcat/websocket/PerMessageDeflate.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/websocket/PerMessageDeflate.java?rev=1732900&r1=1732899&r2=1732900&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/websocket/PerMessageDeflate.java 
(original)
+++ tomcat/trunk/java/org/apache/tomcat/websocket/PerMessageDeflate.java Mon 
Feb 29 14:11:45 2016
@@ -321,7 +321,8 @@ public class PerMessageDeflate implement
                 // Control messages can appear in the middle of other messages
                 // and must not be compressed. Pass it straight through
                 allCompressedParts.add(uncompressedPart);
-            } else if (uncompressedPart.getPayload().limit() == 0) {
+            } else if (uncompressedPart.getPayload().limit() == 0 && 
uncompressedPart.isFin() &&
+                    deflater.getBytesRead() == 0) {
                 // Zero length messages can't be compressed so pass them
                 // straight through.
                 allCompressedParts.add(uncompressedPart);

Modified: tomcat/trunk/webapps/docs/changelog.xml
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=1732900&r1=1732899&r2=1732900&view=diff
==============================================================================
--- tomcat/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/trunk/webapps/docs/changelog.xml Mon Feb 29 14:11:45 2016
@@ -164,6 +164,10 @@
         being thrown for an incomplete message even through the message was
         completed. (markt)
       </fix>
+      <fix>
+        Correctly handle compression of partial messages when the final message
+        fragment has a zero length payload. (markt)
+      </fix>
     </changelog>
   </subsection>
   <subsection name="Web applications">



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to