GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — FlowControlHandler and HttpContentDecompressor do not play nicely together · Issue #15053 · netty/netty Open DescriptionThe following test fails, which indicates behaviour that is surprising to me and I suspect might be a bug: index d9f5cd5b8d..f8edf63a29 100644 --- a/codec-http/src/test/java/io/netty/handler/codec/http/HttpContentDecompressorTest.java +++ b/codec-http/src/test/java/io/netty/handler/codec/http/HttpContentDecompressorTest.java @@ -20,6 +20,7 @@ import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelInboundHandlerAdapter; import io.netty.channel.ChannelOutboundHandlerAdapter; import io.netty.channel.embedded.EmbeddedChannel; +import io.netty.handler.flow.FlowControlHandler; import org.junit.jupiter.api.Test; import java.util.concurrent.atomic.AtomicInteger; @@ -70,4 +71,33 @@ public class HttpContentDecompressorTest { assertEquals(2, readCalled.get()); assertFalse(channel.finishAndReleaseAll()); } + + @Test + public void testFlowController() { + final AtomicInteger messagesEmitted = new AtomicInteger(); + final EmbeddedChannel channel = new EmbeddedChannel( + new FlowControlHandler(), + new HttpContentDecompressor(), + new ChannelInboundHandlerAdapter() { + @Override + public void channelRead(ChannelHandlerContext ctx, Object msg) { + messagesEmitted.incrementAndGet(); + } + }); + + channel.config().setAutoRead(false); + + final HttpResponse response = new DefaultHttpResponse(HttpVersion.HTTP_1_1, HttpResponseStatus.OK); + response.headers().set(HttpHeaderNames.TRANSFER_ENCODING, HttpHeaderValues.CHUNKED); + + assertFalse(channel.writeInbound(response)); + assertFalse(channel.writeInbound(new DefaultHttpContent(Unpooled.buffer(1)))); + assertFalse(channel.writeInbound(new DefaultHttpContent(Unpooled.buffer(1)))); + + assertEquals(1, messagesEmitted.get()); + channel.read(); + assertEquals(2, messagesEmitted.get()); + channel.read(); + assertEquals(3, messagesEmitted.get()); + } } Specifically, with autoread disabled and a This is happening because the Unfortunately I'm not sure whether the problem is that Activity
MetadataMetadataAssigneesLabelsNo labels TypeProjectsMilestoneRelationshipsDevelopmentIssue actions |
| You are visitor 01402775 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |