Conversation
codec-http/src/main/java/io/netty/handler/codec/http/HttpContentCompressor.java
Outdated
Show resolved
Hide resolved
codec-http/src/main/java/io/netty/handler/codec/http/HttpContentCompressor.java
Outdated
Show resolved
Hide resolved
0adae1b to
faa0621
Compare
codec/src/main/java/io/netty/handler/codec/compression/Brotli.java
Outdated
Show resolved
Hide resolved
codec/src/main/java/io/netty/handler/codec/compression/BrotliDecoder.java
Outdated
Show resolved
Hide resolved
codec/src/main/java/io/netty/handler/codec/compression/BrotliEncoder.java
Outdated
Show resolved
Hide resolved
codec/src/main/java/io/netty/handler/codec/compression/BrotliEncoder.java
Outdated
Show resolved
Hide resolved
codec/src/test/java/io/netty/handler/codec/compression/BrotliDecoderTest.java
Outdated
Show resolved
Hide resolved
codec-http/src/main/java/io/netty/handler/codec/http/HttpContentCompressor.java
Outdated
Show resolved
Hide resolved
codec-http/src/main/java/io/netty/handler/codec/http/HttpContentCompressor.java
Outdated
Show resolved
Hide resolved
Fix failing test Revert IDE formatting Revert IDE formatting fixes fix test Revert more
|
@hyperxpro Is brotli compression really supposed to be performed on the fly? From what I've experienced so far, compression seems to be really slow and best performed once and for all for static content, then cached. |
|
@slandelle I agree with your point but Brotli compression speed cost is compensated by the compression ratio. So yeah, we can have it. |
codec-http/src/main/java/io/netty/handler/codec/http/HttpContentCompressor.java
Outdated
Show resolved
Hide resolved
codec-http/src/main/java/io/netty/handler/codec/http/HttpContentCompressor.java
Show resolved
Hide resolved
codec-http/src/main/java/io/netty/handler/codec/http/HttpContentCompressor.java
Show resolved
Hide resolved
codec-http/src/main/java/io/netty/handler/codec/http/HttpContentCompressor.java
Outdated
Show resolved
Hide resolved
codec-http/src/main/java/io/netty/handler/codec/http/HttpContentCompressor.java
Outdated
Show resolved
Hide resolved
idelpivnitskiy
left a comment
There was a problem hiding this comment.
Thank you for the PR @hyperxpro!
+1 for adding tests. For BrotliEncoder it's enough to add a subclass of AbstractEncoderTest. See LzfEncoderTest as an example. But we also need tests for new features of HttpContentCompressor and CompressorHttp2ConnectionEncoder.
Please, also add reference to brotli4j in NOTICE.txt file, and add LICENSE.brotli4j.txt file in license folder. We forgot to do that when we added decoder.
codec/src/main/java/io/netty/handler/codec/compression/BrotliEncoder.java
Show resolved
Hide resolved
codec/src/main/java/io/netty/handler/codec/compression/BrotliEncoder.java
Outdated
Show resolved
Hide resolved
codec-http2/src/main/java/io/netty/handler/codec/http2/CompressorHttp2ConnectionEncoder.java
Outdated
Show resolved
Hide resolved
|
I will add tests once you guys are okay with new commits. |
idelpivnitskiy
left a comment
There was a problem hiding this comment.
BrotliEncoder and its test class LGTM! I will leave HTTP-related classes for others to review as I don't have much context on it.
Please, also add tests for HTTP with "br" compression to cover BrotliContentCompressor and CompressorHttp2ConnectionEncoder.
codec/src/main/java/io/netty/handler/codec/compression/BrotliEncoder.java
Outdated
Show resolved
Hide resolved
codec-http/src/main/java/io/netty/handler/codec/http/BrotliContentCompressor.java
Outdated
Show resolved
Hide resolved
codec-http/src/main/java/io/netty/handler/codec/http/BrotliContentCompressor.java
Outdated
Show resolved
Hide resolved
@normanmaurer Can you help? The test is same as |
@hyperxpro @Override
protected EmbeddedChannel createChannel() {
return new EmbeddedChannel(new BrotliEncoder());
} |
| * A {@link CompressionOptions} instance is thread-safe | ||
| * and should be shared between multiple instances of Compressor. | ||
| */ | ||
| public interface CompressionOptions { |
There was a problem hiding this comment.
I wonder if we should maybe move this to the codec module under the compression package... @trustin WDYT ?
Never seen something this strange. @normanmaurer Any idea? |
idelpivnitskiy
left a comment
There was a problem hiding this comment.
I like new style of CompressionOptions
codec-http2/src/main/java/io/netty/handler/codec/http2/CompressorHttp2ConnectionEncoder.java
Outdated
Show resolved
Hide resolved
codec-http2/src/main/java/io/netty/handler/codec/http2/CompressorHttp2ConnectionEncoder.java
Show resolved
Hide resolved
|
It's in the last call. The compression bug is fixed (by using TEXT mode). |
|
@hyperxpro PTAL ... I think moving the options make more sense |
The API looks amazing. Thanks for the change. :) |
|
@hyperxpro thanks a lot! |
|
Thanks a lot to everyone who participated in this PR and gave their feedback. :) |
Motivation: Currently, Netty only has BrotliDecoder which can decode Brotli encoded data. However, BrotliEncoder is missing which will encode normal data to Brotli encoded data. Modification: Added BrotliEncoder and CompressionOption Result: Fixes #6899. Co-authored-by: Norman Maurer <norman_maurer@apple.com>
| } | ||
|
|
||
| /** | ||
| * @see BrotliOptions#DEFAULT |
There was a problem hiding this comment.
This, as well as other member references in this class's Javadoc, won't be linked properly in generated Javadoc because they are not public. We need to write a proper first sentence, such as:
* Returns the {@link BrotliOptions} with the default compression settings.
There was a problem hiding this comment.
I will do it as I've upcoming PR to enable Brotli tests on Windows.
|
Thanks a lot for your hard work, @hyperxpro! Looking great indeed. Too bad we're not at Java 8 yet, though 😅 |
…11482) Motivation: In #11256, We introduced `Iterable` as a parameter but later in review, it was removed. But we forgot to change `compressionOptionsIterable` to just `compressionOptions`. Modification: Changed `compressionOptionsIterable` to `compressionOptions`. Result: Correct ObjectUtil message
…11482) Motivation: In #11256, We introduced `Iterable` as a parameter but later in review, it was removed. But we forgot to change `compressionOptionsIterable` to just `compressionOptions`. Modification: Changed `compressionOptionsIterable` to `compressionOptions`. Result: Correct ObjectUtil message
Motivation: Currently, Netty only has BrotliDecoder which can decode Brotli encoded data. However, BrotliEncoder is missing which will encode normal data to Brotli encoded data. Modification: Added BrotliEncoder and CompressionOption Result: Fixes netty#6899. Co-authored-by: Norman Maurer <norman_maurer@apple.com>
…etty#11482) Motivation: In netty#11256, We introduced `Iterable` as a parameter but later in review, it was removed. But we forgot to change `compressionOptionsIterable` to just `compressionOptions`. Modification: Changed `compressionOptionsIterable` to `compressionOptions`. Result: Correct ObjectUtil message
…` license ### What changes were proposed in this pull request? This PR aims to update `NOTICE-binary` with `Netty` 4.2.7 license. - https://github.com/netty/netty/blob/netty-4.2.7.Final/NOTICE.txt ### Why are the changes needed? It seems that we updated `Netty Notice` at Apache Spark `3.0.0-preview` with `Netty 4.1.30.Final`. - #25544 Since there are many changes like the following, we need to update it by simply copying and pasting. - Netty 4.1.38.Final - netty/netty#9344 - Netty 4.1.44.Final - netty/netty#9161 - Netty 4.1.54.Final - netty/netty#10773 - Netty 4.1.66.Final - netty/netty#11256 - netty/netty#11437 - Netty 4.1.108.Final - netty/netty#13864 - Netty 4.2.1.Final - netty/netty#14979 - Netty 4.2.7.Final - netty/netty#15658 Additionally, I also double-checked newly added transitive license through ASF [LEGAL-700](https://issues.apache.org/jira/browse/LEGAL-700). We are good to go. - **Apple Public Source License 2.0** - https://spdx.org/licenses/APSL-2.0.html ### Does this PR introduce _any_ user-facing change? No behavior change. ### How was this patch tested? Manual review. ### Was this patch authored or co-authored using generative AI tooling? No. Closes #53335 from dongjoon-hyun/SPARK-54602. Authored-by: Dongjoon Hyun <dongjoon@apache.org> Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
…` license ### What changes were proposed in this pull request? This PR aims to update `NOTICE-binary` with `Netty` 4.2.7 license. - https://github.com/netty/netty/blob/netty-4.2.7.Final/NOTICE.txt ### Why are the changes needed? It seems that we updated `Netty Notice` at Apache Spark `3.0.0-preview` with `Netty 4.1.30.Final`. - #25544 Since there are many changes like the following, we need to update it by simply copying and pasting. - Netty 4.1.38.Final - netty/netty#9344 - Netty 4.1.44.Final - netty/netty#9161 - Netty 4.1.54.Final - netty/netty#10773 - Netty 4.1.66.Final - netty/netty#11256 - netty/netty#11437 - Netty 4.1.108.Final - netty/netty#13864 - Netty 4.2.1.Final - netty/netty#14979 - Netty 4.2.7.Final - netty/netty#15658 Additionally, I also double-checked newly added transitive license through ASF [LEGAL-700](https://issues.apache.org/jira/browse/LEGAL-700). We are good to go. - **Apple Public Source License 2.0** - https://spdx.org/licenses/APSL-2.0.html ### Does this PR introduce _any_ user-facing change? No behavior change. ### How was this patch tested? Manual review. ### Was this patch authored or co-authored using generative AI tooling? No. Closes #53335 from dongjoon-hyun/SPARK-54602. Authored-by: Dongjoon Hyun <dongjoon@apache.org> Signed-off-by: Dongjoon Hyun <dongjoon@apache.org> (cherry picked from commit 191ce4c) Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
Motivation:
Currently, Netty only has BrotliDecoder which can decode Brotli encoded data. However, BrotliEncoder is missing which will encode normal data to Brotli encoded data.
Modification:
Added BrotliEncoder
Result:
Fixes #6899.