485469 - permessage-deflate extension causes protocol error in Firefox/Chrome

+ Correcting behavior for RFC7692: Section 7.2.3.6 (permessage-deflate
  empty fin)
This commit is contained in:
Joakim Erdfelt 2016-01-15 16:26:02 -07:00
parent 9f8df9a1a8
commit 6808953561
2 changed files with 7 additions and 5 deletions

View File

@ -407,12 +407,13 @@ public abstract class CompressExtension extends AbstractExtension
{
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 @@ public abstract class CompressExtension extends AbstractExtension
// no input supplied
needsCompress = false;
}
ByteArrayOutputStream out = new ByteArrayOutputStream();
byte[] output = new byte[outputLength];
@ -486,7 +487,8 @@ public abstract class CompressExtension extends AbstractExtension
}
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 });
}

View File

@ -33,7 +33,7 @@ import org.eclipse.jetty.websocket.common.OpCode;
/**
* 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
{