Bug 391591 - WebSocket client should support x-webkit-deflate-frame

* Adding test + hack for BFINAL 0 vs BFINAL 1
This commit is contained in:
Joakim Erdfelt 2012-10-10 11:34:32 -07:00
parent 0cc7b5f907
commit 1892dbfa03

View File

@ -42,6 +42,7 @@ public class WebkitDeflateFrameExtension extends Extension
{
private static final Logger LOG = Log.getLogger(WebkitDeflateFrameExtension.class);
private static final int BUFFER_SIZE = 64 * 1024;
private static final boolean BFINAL_HACK = Boolean.parseBoolean(System.getProperty("jetty.websocket.bfinal.hack","true"));
private Deflater deflater;
private Inflater inflater;
@ -79,6 +80,8 @@ public class WebkitDeflateFrameExtension extends Extension
}
BufferUtil.flipToFlush(buf,0);
if (BFINAL_HACK)
{
/* Per the spec, it says that BFINAL 1 or 0 are allowed.
* However, Java always uses BFINAL 1, where the browsers
* Chrome and Safari fail to decompress when it encounters
@ -91,6 +94,7 @@ public class WebkitDeflateFrameExtension extends Extension
{
buf.put(0,(b0 ^= 1)); // flip bit to BFINAL 0
}
}
return buf;
}