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

Add support for snappy http content encoding #13529

Merged
merged 10 commits into from Aug 17, 2023

Conversation

skyguard1
Copy link
Contributor

Motivation:

Since netty already supports the decompression of snappy's http content encoding, it should also consider supporting snappy's http content compression

Modification:

Add support for snappy http content encoding

Result:

Netty supports snappy http content encoding

Signed-off-by: xingrufei <qhdxssm@qq.com>
Signed-off-by: xingrufei <qhdxssm@qq.com>
Signed-off-by: xingrufei <qhdxssm@qq.com>
Signed-off-by: xingrufei <qhdxssm@qq.com>
* {@link SnappyOptions} holds config for
* Snappy compression.
*/
public class SnappyOptions implements CompressionOptions {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
public class SnappyOptions implements CompressionOptions {
public final class SnappyOptions implements CompressionOptions {

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@Test
public void snappyEncodingSingleEmptyMessage() throws Exception {
final String text = "";
final ByteBuf data = Unpooled.copiedBuffer(text.getBytes());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
final ByteBuf data = Unpooled.copiedBuffer(text.getBytes());
final ByteBuf data = Unpooled.copiedBuffer(text.getBytes(CharsetUtil.US_ASCII));

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@Test
public void snappyEncodingSingleMessage() throws Exception {
final String text = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbccccccccccccccccccccccc";
final ByteBuf data = Unpooled.copiedBuffer(text.getBytes(CharsetUtil.UTF_8.name()));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
final ByteBuf data = Unpooled.copiedBuffer(text.getBytes(CharsetUtil.UTF_8.name()));
final ByteBuf data = Unpooled.copiedBuffer(text.getBytes(CharsetUtil.US_ASCII)));

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Signed-off-by: xingrufei <qhdxssm@qq.com>
@normanmaurer normanmaurer merged commit 602cdbe into netty:4.1 Aug 17, 2023
14 checks passed
@normanmaurer
Copy link
Member

@skyguard1 thanks a lot

@skyguard1
Copy link
Contributor Author

It is my pleasure

normanmaurer pushed a commit that referenced this pull request Aug 17, 2023
Motivation:

Since netty already supports the decompression of snappy's http content
encoding, it should also consider supporting snappy's http content
compression

Modification:

Add support for snappy http content encoding

Result:

Netty supports snappy http content encoding

---------

Signed-off-by: xingrufei <qhdxssm@qq.com>
@normanmaurer normanmaurer added this to the 4.1.97.Final milestone Aug 23, 2023
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 this pull request may close these issues.

None yet

3 participants