485469 - permessage-deflate extension causes protocol error in Firefox/Chrome
+ Correcting behavior for RFC7692: Section 7.2.3.6 (permessage-deflate
empty fin)
diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/compress/CompressExtension.java b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/compress/CompressExtension.java
index 6fc9b53..ac32ad6 100644
--- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/compress/CompressExtension.java
+++ b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/compress/CompressExtension.java
@@ -407,12 +407,13 @@
{
Frame frame = entry.frame;
BatchMode batchMode = entry.batchMode;
- if (OpCode.isControlFrame(frame.getOpCode()) || !frame.hasPayload())
+ if (OpCode.isControlFrame(frame.getOpCode()))
{
+ // Do not deflate control frames
nextOutgoingFrame(frame,this,batchMode);
return;
}
-
+
compress(entry,true);
}
@@ -434,7 +435,7 @@
// no input supplied
needsCompress = false;
}
-
+
ByteArrayOutputStream out = new ByteArrayOutputStream();
byte[] output = new byte[outputLength];
@@ -486,7 +487,8 @@
}
else if (fin)
{
- // Special case: 8.2.3.6. Generating an Empty Fragment Manually
+ // Special case: 7.2.3.6. Generating an Empty Fragment Manually
+ // https://tools.ietf.org/html/rfc7692#section-7.2.3.6
payload = ByteBuffer.wrap(new byte[] { 0x00 });
}
diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/compress/PerMessageDeflateExtension.java b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/compress/PerMessageDeflateExtension.java
index c307e53..93ea4fb 100644
--- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/compress/PerMessageDeflateExtension.java
+++ b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/compress/PerMessageDeflateExtension.java
@@ -33,7 +33,7 @@
/**
* Per Message Deflate Compression extension for WebSocket.
* <p>
- * Attempts to follow <a href="https://tools.ietf.org/html/draft-ietf-hybi-permessage-compression-12">draft-ietf-hybi-permessage-compression-12</a>
+ * Attempts to follow <a href="https://tools.ietf.org/html/rfc7692">Compression Extensions for WebSocket</a>
*/
public class PerMessageDeflateExtension extends CompressExtension
{