set result in ComposedLastHttpContent instead of being null #8721
set result in ComposedLastHttpContent instead of being null #8721normanmaurer merged 1 commit intonetty:4.1from
Conversation
|
Can one of the admins verify this patch? |
normanmaurer
left a comment
There was a problem hiding this comment.
Can you add a unit test as well ?
|
@netty-bot test this please |
ac10f44 to
4539071
Compare
|
I added tests (to existing) compression/encoding tests - but I was not able to test decompression/decoding. I will try tomorrow. |
|
@netty-bot test this please |
|
@normanmaurer so, should I add test for decompression/decoding ? because I see that you approved this already. |
|
@KowalczykBartek if you can sure... that said if you are too busy its fine as well and we can do a followup. |
|
No, I will do it today, please wait with merging. update: I was not able to finish that test - cannot pass trailing headers in decompression, i will continue that tomorrow. |
|
@KowalczykBartek let me know once done as I would like to include this in the next release if possible |
|
@normanmaurer I created test (that was challenging :D ). The only problem with that test is ... It do not pass, because my trailer is missing - after some debugging I noticed that it(trailer) is correctly parsed but at the end is ignored :( line = headerParser.parse(buffer);
if (line == null) {
return null;
}I modified slightly this code, line = headerParser.parse(buffer);
if (line == null) {
if(!trailer.trailingHeaders().isEmpty())
{
this.trailer = null;
return trailer;
}
return null;
}and my test pass - but for sure this change breaks other stuff :D I will try to understand HttpObjectDecoder, but maybe you see mistake that I done in my test (or there is a bug in parsing logic)? Thanks in advance :) |
0d747d5 to
c46455e
Compare
|
yeah ! I figured out what was wrong - and pushed the change ! Question: assertTrue(channel.writeInbound(Unpooled.copiedBuffer("My-Trailer: 42", CharsetUtil.US_ASCII)));
assertTrue(channel.writeInbound(Unpooled.copiedBuffer("\r\n", CharsetUtil.US_ASCII)));
assertTrue(channel.writeInbound(Unpooled.copiedBuffer("\r\n\r\n", CharsetUtil.US_ASCII)));but can parse that: assertTrue(channel.writeInbound(Unpooled.copiedBuffer("My-Trailer: 42\r\n\r\n\r\n", CharsetUtil.US_ASCII)));? |
|
Yes... please open an issue
… Am 19.01.2019 um 19:42 schrieb Bartek Kowalczyk ***@***.***>:
yeah ! I found what was wrong - and pushed the change !
Question:
Can I say that it is a bug when HttpObjectDecoder cannot parse that:
assertTrue(channel.writeInbound(Unpooled.copiedBuffer("My-Trailer: 42", CharsetUtil.US_ASCII)));
assertTrue(channel.writeInbound(Unpooled.copiedBuffer("\r\n", CharsetUtil.US_ASCII)));
assertTrue(channel.writeInbound(Unpooled.copiedBuffer("\r\n\r\n", CharsetUtil.US_ASCII)));
but can parse that:
assertTrue(channel.writeInbound(Unpooled.copiedBuffer("My-Trailer: 42\r\n\r\n\r\n", CharsetUtil.US_ASCII)));
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
|
I created an issue : #8736 |
|
@netty-bot test this please |
|
@KowalczykBartek please fix the checkstyle errors: 13:35:18 /code/codec-http/src/test/java/io/netty/handler/codec/http/HttpContentDecoderTest.java:104:52: Unnecessary parentheses around expression. Also please ensure you release all messages that implement |
Signed-off-by: Kowalczyk <bkowalczyyk@gmail.com>
c46455e to
9346cc0
Compare
|
Fixed checkstyle errors (now no errors after mvn clean package) - btw sorry I forget about code-style :D
Fixed, from what I understand only DefaultHttpContent has disposable content. |
|
@netty-bot Test this please |
|
@KowalczykBartek thanks a lot! |
Motivation: I want to fix bug in vert.x project (eclipse-vertx/vert.x#2562) caused by ComposedLastHttpContent result being null. I don't know if it is intentional that this last decoded chuck in the issue returns null, but if not - I am providing fix for that. Modification: * Added new constructor in ComposedLastHttpContent allowing to pass DecoderResult * set DecoderResult.SUCCESS for created ComposedLastHttpContent in HttpContentEncoder * set DecoderResult.SUCCESS for created ComposedLastHttpContent in HttpContentDecoder Result: Fixes eclipse-vertx/vert.x#2562
Motivation:
I want to fix bug in vert.x project (eclipse-vertx/vert.x#2562) caused by ComposedLastHttpContent result being null. I don't know if it is intentional that this last decoded chuck in the issue returns null, but if not - I am providing fix for that.
Modification:
Result:
Fixes eclipse-vertx/vert.x#2562
cheers!