Home / Function/ mustRejectImproperlyTerminatedChunkBodies() — netty Function Reference

mustRejectImproperlyTerminatedChunkBodies() — netty Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  0cf43d8e_9258_60da_c154_b9a9b0be4bc1["mustRejectImproperlyTerminatedChunkBodies()"]
  514322d5_436a_d1ac_6240_1f9cf42934a4["HttpRequestDecoderTest"]
  0cf43d8e_9258_60da_c154_b9a9b0be4bc1 -->|defined in| 514322d5_436a_d1ac_6240_1f9cf42934a4
  style 0cf43d8e_9258_60da_c154_b9a9b0be4bc1 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

codec-http/src/test/java/io/netty/handler/codec/http/HttpRequestDecoderTest.java lines 666–696

    @Test
    void mustRejectImproperlyTerminatedChunkBodies() throws Exception {
        // See full explanation: https://w4ke.info/2025/06/18/funky-chunks.html
        String requestStr = "GET /one HTTP/1.1\r\n" +
                "Host: localhost\r\n" +
                "Transfer-Encoding: chunked\r\n\r\n" +
                "5\r\n" +
                "AAAAAXX" + // Chunk body contains extra (XX) bytes, and no CRLF terminator.
                "45\r\n" +
                "0\r\n" +
                "GET /two HTTP/1.1\r\n" +
                "Host: localhost\r\n" +
                "Transfer-Encoding: chunked\r\n\r\n" +
                "0\r\n\r\n";
        EmbeddedChannel channel = new EmbeddedChannel(new HttpRequestDecoder());
        assertTrue(channel.writeInbound(Unpooled.copiedBuffer(requestStr, CharsetUtil.US_ASCII)));
        HttpRequest request = channel.readInbound();
        assertFalse(request.decoderResult().isFailure()); // We parse the headers just fine.
        assertTrue(request.headers().names().contains("Transfer-Encoding"));
        assertTrue(request.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/HttpRequestDecoderTest.java.
Where is mustRejectImproperlyTerminatedChunkBodies() defined?
mustRejectImproperlyTerminatedChunkBodies() is defined in codec-http/src/test/java/io/netty/handler/codec/http/HttpRequestDecoderTest.java at line 666.

Analyze Your Own Codebase

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

Try Supermodel Free