Commit 61d75db
Fix BrotliEncoder bug that does not mark ByteBuf it encodes as read (#13497)
Motivation:
The contract between HttpContentCompressor and compression encoders assumes that encoders will mark the encoded ByteBuf as read after they have been encoded, otherwise the HttpContentCompressor will send encoded chunk twice (one time decoded and one time encoded). The BrotliEncoder peeks the ByteBuf nio buffer and pass it to the BrotliChannelEncoder without marking the ByteBuf and does not respect the implicit contract with HttpContentCompressor.
Modifications:
The BrotliEncoder now will set skip bytes of encoded ByteBuf, in addition the test generic AbstractEncoderTest has been modified to ensure that the readable bytes of a ByteBuf is equals to 0 after it has been encoded.
Result:
This fixes the bug.
---------
Co-authored-by: Norman Maurer <norman_maurer@apple.com>1 parent 4e1a0c3 commit 61d75db
2 files changed
Lines changed: 7 additions & 1 deletion
File tree
- codec/src
- main/java/io/netty/handler/codec/compression
- test/java/io/netty/handler/codec/compression
Lines changed: 4 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
205 | 205 | | |
206 | 206 | | |
207 | 207 | | |
208 | | - | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
209 | 212 | | |
210 | 213 | | |
211 | 214 | | |
| |||
Lines changed: 3 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
87 | 87 | | |
88 | 88 | | |
89 | 89 | | |
| 90 | + | |
90 | 91 | | |
91 | 92 | | |
92 | 93 | | |
| |||
101 | 102 | | |
102 | 103 | | |
103 | 104 | | |
| 105 | + | |
104 | 106 | | |
105 | 107 | | |
106 | 108 | | |
107 | 109 | | |
108 | 110 | | |
109 | 111 | | |
| 112 | + | |
110 | 113 | | |
111 | 114 | | |
112 | 115 | | |
| |||
0 commit comments