Home / Function/ mustRejectImproperlyTerminatedChunkBodies() — netty Function Reference

mustRejectImproperlyTerminatedChunkBodies() — netty Function Reference

Architecture documentation for the mustRejectImproperlyTerminatedChunkBodies() function in HttpResponseDecoderTest.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  629e3a6f_efe5_6267_493d_aeb188189f98["mustRejectImproperlyTerminatedChunkBodies()"]
  90546a8c_51c4_a9dc_b6e8_695d29269596["HttpResponseDecoderTest"]
  629e3a6f_efe5_6267_493d_aeb188189f98 -->|defined in| 90546a8c_51c4_a9dc_b6e8_695d29269596
  style 629e3a6f_efe5_6267_493d_aeb188189f98 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

codec-http/src/test/java/io/netty/handler/codec/http/HttpResponseDecoderTest.java lines 1027–1055

    @Test
    void mustRejectImproperlyTerminatedChunkBodies() throws Exception {
        // See full explanation: https://w4ke.info/2025/06/18/funky-chunks.html
        String requestStr = "HTTP/1.1 200 OK\r\n" +
                "Transfer-Encoding: chunked\r\n\r\n" +
                "5\r\n" +
                "AAAAXX" + // Chunk body contains extra (XX) bytes, and no CRLF terminator.
                "1D\r\n" +
                "0\r\n" +
                "HTTP/1.1 200 OK\r\n" +
                "Transfer-Encoding: chunked\r\n\r\n" +
                "0\r\n\r\n";
        EmbeddedChannel channel = new EmbeddedChannel(new HttpResponseDecoder());
        assertTrue(channel.writeInbound(Unpooled.copiedBuffer(requestStr, CharsetUtil.US_ASCII)));
        HttpResponse response = channel.readInbound();
        assertFalse(response.decoderResult().isFailure()); // We parse the headers just fine.
        assertTrue(response.headers().names().contains("Transfer-Encoding"));
        assertTrue(response.headers().contains("Transfer-Encoding", "chunked", false));
        HttpContent content = channel.readInbound();
        assertFalse(content.decoderResult().isFailure()); // We parse the content promised by the chunk length.
        content.release();

        content = channel.readInbound();
        DecoderResult decoderResult = content.decoderResult();
        assertTrue(decoderResult.isFailure()); // But then parsing the chunk delimiter must fail.
        assertThat(decoderResult.cause()).isInstanceOf(InvalidChunkTerminationException.class);
        content.release();
        assertFalse(channel.finish());
    }

Domain

Subdomains

Frequently Asked Questions

What does mustRejectImproperlyTerminatedChunkBodies() do?
mustRejectImproperlyTerminatedChunkBodies() is a function in the netty codebase, defined in codec-http/src/test/java/io/netty/handler/codec/http/HttpResponseDecoderTest.java.
Where is mustRejectImproperlyTerminatedChunkBodies() defined?
mustRejectImproperlyTerminatedChunkBodies() is defined in codec-http/src/test/java/io/netty/handler/codec/http/HttpResponseDecoderTest.java at line 1027.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free