Add premessage-deflate extension handler for HTTP WebSocket

Add premessage-deflate extension handler for HTTP WebSocket.

Motivation:
- Need to compress HTTP WebSocket frames payload.

Modifications:
- Remove UTF8 checking of WebSocketFrames from frame decoder in order to
allow compressed frames to go to the next handler.
- Add a WebsocketPremessageDeflateHandler to initialize the frame deflater/inflater if client is compatible with deflate extension.

Result:
First version of the implementation for feedback.
What exactly we would need to expose to make it work for your usecase?

> Am 16.06.2014 um 17:11 schrieb fboucher38 <notifications@github.com>:
> 
> In codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebsocketPremessageDeflateExtensionHandler.java:
> 
> > +                        deflateEnabled = true;
> > +                        Map<String, String> parameters = extensions.get(DEFLATE_HEADER);
> > +                        Iterator<Entry<String, String>> parametersIterator = parameters.entrySet().iterator();
> > +
> > +                        while (deflateEnabled && parametersIterator.hasNext()) {
> > +                            String parameter = parametersIterator.next().getKey();
> > +                            if (CLIENT_MAX_WINDOW.equalsIgnoreCase(parameter)) {
> > +                                // TODO: handle client_max_window_bits - nothing to do if ignored
> > +                            } else if (SERVER_MAX_WINDOW.equalsIgnoreCase(parameter)) {
> > +                                // TODO: handle server_max_window_bits
> > +                                deflateEnabled = false;
> > +                            } else if (CLIENT_NO_CONTEXT.equalsIgnoreCase(parameter)) {
> > +                                // TODO: handle client_no_context_takeover - nothing to do if ignored
> > +                            } else if (SERVER_NO_CONTEXT.equalsIgnoreCase(parameter)) {
> > +                                // TODO: handle server_no_context_takeover
> > +                                deflateEnabled = false;
> About the maxWindow, I'm facing a limitation of the JdkZlibEncoder that doesn't handle the windowSize at:
> 
> public static ZlibEncoder newZlibEncoder(ZlibWrapper wrapper, int compressionLevel, int windowBits, int memLevel) {
>         if (PlatformDependent.javaVersion() < 7) {
>             return new JZlibEncoder(wrapper, compressionLevel, windowBits, memLevel);
>         } else {
>             return new JdkZlibEncoder(wrapper, compressionLevel);
>         }
> }
> So, for the moment, I cannot manage server_max_window_bits and client_max_window_bits properly.
> 
> —
> Reply to this email directly or view it on GitHub.