Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extend decompression of HttpContentDecompressor.java #13307

Closed
redcinelli opened this issue Mar 29, 2023 · 3 comments · Fixed by #13312
Closed

Extend decompression of HttpContentDecompressor.java #13307

redcinelli opened this issue Mar 29, 2023 · 3 comments · Fixed by #13312

Comments

@redcinelli
Copy link
Contributor

Actual behaviour

At the moment the HttpContentDecompressor.java support:

  • deflate
  • gzip
  • brotli

I wonder if we should extend it ?
I am specifically in need of supporting snappy

        if (GZIP.contentEqualsIgnoreCase(contentEncoding) ||
            X_GZIP.contentEqualsIgnoreCase(contentEncoding)) {
            return new EmbeddedChannel(ctx.channel().id(), ctx.channel().metadata().hasDisconnect(),
                    ctx.channel().config(), ZlibCodecFactory.newZlibDecoder(ZlibWrapper.GZIP));
        }
        if (DEFLATE.contentEqualsIgnoreCase(contentEncoding) ||
            X_DEFLATE.contentEqualsIgnoreCase(contentEncoding)) {
            final ZlibWrapper wrapper = strict ? ZlibWrapper.ZLIB : ZlibWrapper.ZLIB_OR_NONE;
            // To be strict, 'deflate' means ZLIB, but some servers were not implemented correctly.
            return new EmbeddedChannel(ctx.channel().id(), ctx.channel().metadata().hasDisconnect(),
                    ctx.channel().config(), ZlibCodecFactory.newZlibDecoder(wrapper));
        }
        if (Brotli.isAvailable() && BR.contentEqualsIgnoreCase(contentEncoding)) {
            return new EmbeddedChannel(ctx.channel().id(), ctx.channel().metadata().hasDisconnect(),
              ctx.channel().config(), new BrotliDecoder());
        }

I am opening this issue to talk about that.
Is it something Netty would be interested in seeing happening ?
I could be doing the PR if needed.

Netty version

4.1

@hyperxpro
Copy link
Contributor

Extend the HttpContentDecompressor and override the newContentDecoder for Snappy and delegate the rest to super#newContentDecoder.

@redcinelli
Copy link
Contributor Author

Extend the HttpContentDecompressor and override the newContentDecoder for Snappy and delegate the rest to super#newContentDecoder.

Thanks for the guidance @hyperxpro, I assume this means Pr's are welcome ? I'll be working on it then ^^

@hyperxpro
Copy link
Contributor

They're! ^^

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants